Skip to content

Commit eec3622

Browse files
authored
[angular-ngrx-scss]: add rem function and some default padding values (#1960)
* refactor: add rem function and some default padding values * fix: add style preprocessor options for tests
1 parent 6e3ae70 commit eec3622

36 files changed

Lines changed: 266 additions & 212 deletions

angular-ngrx-scss/angular.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@
3232
"assets": ["src/favicon.ico", "src/assets", "src/_redirects"],
3333
"styles": ["src/styles.scss"],
3434
"scripts": [],
35-
"allowedCommonJsDependencies": ["@primer/octicons", "prismjs"]
35+
"allowedCommonJsDependencies": ["@primer/octicons", "prismjs"],
36+
"stylePreprocessorOptions": {
37+
"includePaths": ["src/app/shared/styles"]
38+
}
3639
},
3740
"configurations": {
3841
"production": {
@@ -95,7 +98,10 @@
9598
"inlineStyleLanguage": "scss",
9699
"assets": ["src/favicon.ico", "src/assets"],
97100
"styles": ["src/styles.scss"],
98-
"scripts": []
101+
"scripts": [],
102+
"stylePreprocessorOptions": {
103+
"includePaths": ["src/app/shared/styles"]
104+
}
99105
}
100106
},
101107
"lint": {

angular-ngrx-scss/src/app/auth/auth.component.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@use '../shared/styles/variables';
1+
@use 'variables';
2+
@use 'functions';
23

34
.page {
45
position: absolute;
@@ -18,9 +19,9 @@
1819

1920
.button {
2021
width: 34%;
21-
padding: 1rem;
22+
padding: variables.$padding--l;
2223
border: 1px solid variables.$gray500;
23-
border-radius: 0.375rem;
24+
border-radius: functions.rem(5);
2425
font-weight: 500;
2526
font-size: 100%;
2627
background: variables.$black;
@@ -35,7 +36,7 @@
3536

3637
.netlify-badge-container {
3738
position: fixed;
38-
bottom: 1rem;
39+
bottom: variables.$padding--l;
3940
left: 0;
4041
right: 0;
4142
display: flex;

angular-ngrx-scss/src/app/file-viewer/components/file-code/file-code.component.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@use '../../../shared/styles/variables';
1+
@use 'variables';
22

33
:host {
44
border: 1px solid variables.$gray100;

angular-ngrx-scss/src/app/file-viewer/components/file-explorer-about/file-explorer-about.component.scss

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
@use '../../../shared/styles/variables';
1+
@use 'variables';
2+
@use 'functions';
23

34
a {
45
color: variables.$gray500;
56
}
67

78
a > span,
89
.link {
9-
margin-right: 0.5rem;
10+
margin-right: variables.$padding;
1011
}
1112

1213
.mt-1 {
13-
margin-top: 1rem;
14+
margin-top: variables.$padding--l;
1415
}
1516

1617
.topic {
17-
padding: 0.25rem 0.5rem;
18-
margin-right: 0.375rem;
18+
padding: variables.$padding--s variables.$padding;
19+
margin-right: functions.rem(5);
1920
background-color: variables.$blue100;
2021
transition-property: background-color, border-color, color, fill, stroke;
2122
color: variables.$blue600;
22-
font-size: 0.75rem;
23-
line-height: 1rem;
23+
font-size: functions.rem(11);
24+
line-height: variables.$padding--l;
2425
font-weight: 500;
25-
border-radius: 0.75rem;
26+
border-radius: functions.rem(11);
2627
cursor: pointer;
2728

2829
&:hover {

angular-ngrx-scss/src/app/file-viewer/components/file-text/file-text.component.scss

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
@use '../../../shared/styles/variables';
1+
@use 'variables';
2+
@use 'functions';
23

34
:host {
45
border: 1px solid variables.$gray100;
@@ -13,15 +14,15 @@
1314
border-spacing: 5px;
1415
background-color: variables.$white;
1516
overflow: auto;
16-
padding: 0.25rem 2rem;
17-
font-size: 0.75rem;
18-
line-height: 1rem;
17+
padding: variables.$padding--s functions.rem(28);
18+
font-size: functions.rem(11);
19+
line-height: variables.$padding--l;
1920
text-align: left;
2021
}
2122

2223
.lineNumber {
2324
display: table-cell;
24-
padding-right: 1rem;
25+
padding-right: variables.$padding--l;
2526
color: variables.$gray500;
2627
text-align: right;
2728
user-select: none;

angular-ngrx-scss/src/app/file-viewer/file-explorer-container/file-explorer-container.component.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
@use '../../shared/styles/variables';
1+
@use 'variables';
22

33
.file-list {
44
border: 1px solid variables.$gray300;
5-
border-radius: 0.25rem;
5+
border-radius: variables.$padding--s;
66
display: flex;
77
flex-direction: column;
88
}

angular-ngrx-scss/src/app/file-viewer/file-explorer-nav/file-explorer-nav.component.scss

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
@use '../../shared/styles/variables';
1+
@use 'variables';
2+
@use 'functions';
23

34
.file-explorer-container {
45
display: flex;
5-
margin-top: 1.5rem;
6-
margin-bottom: 1.5rem;
6+
margin-top: functions.rem(21);
7+
margin-bottom: functions.rem(21);
78
align-items: center;
89
}
910

1011
.btn {
1112
display: inline-flex;
1213
position: relative;
13-
padding: 0.25rem 1rem;
14+
padding: variables.$padding--s variables.$padding--l;
1415
background-color: variables.$gray50;
1516
color: variables.$gray700;
1617
font-weight: 500;
1718
align-items: center;
18-
border-radius: 0.375rem;
19+
border-radius: functions.rem(5);
1920
border-width: 1px;
2021
border-color: variables.$gray300;
2122

@@ -26,24 +27,24 @@
2627
}
2728

2829
.btnIcon {
29-
margin-right: 0.25rem;
30+
margin-right: variables.$padding--s;
3031
color: variables.$gray600;
31-
width: 1.25rem;
32-
height: 1.25rem;
32+
width: functions.rem(18);
33+
height: functions.rem(18);
3334
}
3435

3536
.btnCaret {
3637
font-size: 10px;
37-
margin-top: 0.125rem;
38-
margin-left: 0.375rem;
38+
margin-top: functions.rem(2);
39+
margin-left: functions.rem(5);
3940
color: variables.$gray600;
4041
}
4142

4243
.separator {
43-
margin-left: 0.375rem;
44-
margin-right: 0.375rem;
44+
margin-left: functions.rem(5);
45+
margin-right: functions.rem(5);
4546
color: variables.$gray800;
46-
font-size: 1.125rem;
47+
font-size: functions.rem(16);
4748
line-height: 1.375;
4849
}
4950

@@ -58,8 +59,8 @@
5859

5960
.crumbs {
6061
display: flex;
61-
padding-left: 0.75rem;
62-
padding-right: 0.75rem;
62+
padding-left: functions.rem(11);
63+
padding-right: functions.rem(11);
6364
}
6465

6566
.crumbLink {
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@use 'functions';
2+
13
.container.subpage {
2-
gap: 2rem;
4+
gap: functions.rem(28);
35
}

angular-ngrx-scss/src/app/file-viewer/file-viewer/file-viewer.component.scss

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,48 @@
1-
@use '../../shared/styles/variables';
1+
@use 'variables';
2+
@use 'functions';
23

34
.file-viewer-container {
45
overflow: hidden;
5-
border-radius: 0.5rem;
6+
border-radius: variables.$padding;
67
border-width: 1px;
78
border-color: variables.$gray300;
89
}
910

1011
.fileHeader {
11-
padding: 0.75rem 1rem;
12+
padding: functions.rem(11) variables.$padding--l;
1213
background-color: variables.$gray100;
1314
color: variables.$gray800;
1415
font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New',
1516
monospace;
16-
font-size: 0.75rem;
17-
line-height: 1rem;
17+
font-size: functions.rem(11);
18+
line-height: variables.$padding--l;
1819
border-bottom-width: 1px;
1920
border-color: variables.$gray300;
2021
}
2122

2223
.fileHeaderLines {
23-
padding-left: 0.5rem;
24-
padding-right: 0.5rem;
24+
padding-left: variables.$padding;
25+
padding-right: variables.$padding;
2526
}
2627

2728
.fileHeaderBytes {
28-
padding-left: 0.5rem;
29-
padding-right: 0.5rem;
29+
padding-left: variables.$padding;
30+
padding-right: variables.$padding;
3031
border-left: 1px solid variables.$gray300;
3132
}
3233

3334
.codeBlock {
3435
border-spacing: 5px;
3536
overflow: auto;
36-
padding: 0.25rem 2rem;
37-
font-size: 0.75rem;
38-
line-height: 1rem;
37+
padding: variables.$padding--s functions.rem(28);
38+
font-size: functions.rem(11);
39+
line-height: variables.$padding--l;
3940
text-align: left;
4041
}
4142

4243
.lineNumber {
4344
display: table-cell;
44-
padding-right: 1rem;
45+
padding-right: variables.$padding--l;
4546
color: variables.$gray500 !important;
4647
text-align: right;
4748
user-select: none;
Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
@use '../../shared/styles/variables.scss';
1+
@use 'variables';
2+
@use 'functions';
23

34
.header {
45
position: sticky;
56
z-index: 3;
67
top: 0;
78
background-color: variables.$white;
89
font-weight: 600;
9-
padding: 0.625rem;
10+
padding: functions.rem(9);
1011
border: 1px solid variables.$gray300;
11-
border-radius: 0.25rem;
12+
border-radius: variables.$padding--s;
1213

1314
.icon {
14-
margin-right: 0.5rem;
15+
margin-right: variables.$padding;
1516
}
1617
}
1718

1819
.content {
19-
padding: 0.625rem;
20+
padding: functions.rem(9);
2021
border: 1px solid variables.$gray300;
21-
border-radius: 0.25rem;
22+
border-radius: variables.$padding--s;
2223
border-top: none;
2324
}

0 commit comments

Comments
 (0)