Skip to content

Commit c6c01f5

Browse files
committed
feat: Use CSS variables instead of SASS variables
In preparation for theming with #142
1 parent c8ea13c commit c6c01f5

14 files changed

+364
-229
lines changed

app/assets/stylesheets/application.sass

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
*/
1313

1414
@import general/variables
15+
@import general/css4
1516

1617
// general styles
1718
@import general/mixins

app/assets/stylesheets/forms/_confirmation.sass

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
padding: 30px 0
66

77
.success_message
8-
background: $primary
9-
color: $white_pure
8+
@include css4
9+
background: var(--primary)
10+
@include css4
11+
color: var(--white-pure)
1012
margin: 0 auto 25px auto
1113
padding: 10px 30px
1214
a

app/assets/stylesheets/forms/_forms.sass

Lines changed: 54 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
$form-spacing-horizontal: 9px
22

33
#disclaimer, .alert
4-
background: $alert--background
5-
color: $alert--text
4+
@include css4
5+
background: var(--alert--background)
6+
color: var(--alert--text)
7+
border: 1px solid var(--alert--border)
68
margin: 5px auto 55px auto
79
padding: 18px 35px
810
line-height: 1.4
9-
border: 1px solid $alert--border
1011
border-radius: 3px
1112
box-shadow: 0 6px 35px rgba(0, 0, 0, .1)
1213

@@ -28,22 +29,25 @@ fieldset
2829
margin-right: -10px
2930

3031
legend
31-
background: $black
32-
color: $white
32+
@include css4
33+
background: var(--black)
34+
color: var(--white)
3335
width: 100%
3436
text-align: center
3537
padding: 0.5em
3638

3739
hr
3840
border: none
39-
border-top: 1px solid $input--border-color
41+
@include css4
42+
border-top: 1px solid var(--input--border-color)
4043
margin: 35px 0 40px
4144
width: 80px
4245

4346
.alert
44-
color: $alert--text--error
45-
background: $alert--background--error
46-
border-color: $alert--border--error
47+
@include css4
48+
color: var(--alert--text--error)
49+
background: var(--alert--background--error)
50+
border-color: var(--alert--border--error)
4751

4852
.form-container, .cancel_btn_wrap
4953
margin: 0 auto
@@ -58,18 +62,21 @@ hr
5862
margin-bottom: 30px
5963

6064
.simple_form
61-
color: $grey
65+
@include css4
66+
color: var(--grey)
6267
.error
63-
background: $input--error--background
64-
color: $input--error--text
68+
@include css4
69+
background: var(--input--error--background)
70+
color: var(--input--error--text)
6571
font-size: 0.74rem
6672
padding: 6px 9px
6773
flex: 1 1 100%
6874
abbr
6975
text-decoration: none
7076
position: absolute
7177
margin-left: -16px
72-
color: $input--required-star
78+
@include css4
79+
color: var(--input--required-star)
7380
align-self: flex-start
7481

7582
.form-inputs
@@ -99,36 +106,41 @@ label
99106
align-items: center
100107
width: 100%
101108
flex-shrink: 0
102-
font-weight: $font-light
109+
@include css4
110+
font-weight: var(--font-light)
103111
padding-top: 5px
104112
padding-bottom: 8px
105113
text-align: left
106114

107115
// all form input types
108116
input[type=text], input[type=email], input[type=tel], input[type=date], input[type="url"], input[type=password], input[type=file], input[type=checkbox], input[type=radio], textarea, select
109-
background: $input--background
110-
color: $input--text
111-
font-family: $font-body-family
112-
font-weight: $font-reg
117+
@include css4
118+
background: var(--input--background)
119+
color: var(--input--text)
120+
font-family: var(--font-body-family)
121+
font-weight: var(--font-reg)
122+
border: 1px solid var(--input--border-color)
113123
font-size: 100%
114-
border: 1px solid $input--border-color
115124
margin-bottom: 5px
116125
outline: none
117126
padding: 9px 14px
118127
width: 100%
119128
@include transition(150ms, border-color, ease-out, 0ms)
120-
@include placeholder-color($input--text--placeholder)
129+
@include css4
130+
@include placeholder-color(var(--input--text--placeholder))
121131
&:focus
122-
color: $input--text--focus
123-
background-color: $input--background--focus
124-
border-color: $input--border-color--focus
132+
@include css4
133+
color: var(--input--text--focus)
134+
background-color: var(--input--background--focus)
135+
border-color: var(--input--border-color--focus)
125136
border-width: 2px
126137
padding: 8px 13px
127138

128139
// just selects
129140
select
130141
@include appearance (none)
131-
background: asset-url("arrow_down_hover.svg"), $input--background
142+
@include css4
143+
background: asset-url("arrow_down_hover.svg"), var(--input--background)
132144
background-repeat: no-repeat
133145
background-position: right
134146
background-size: auto 100%
@@ -162,7 +174,8 @@ input[type=checkbox]
162174
-moz-osx-font-smoothing: grayscale
163175
// end .fa
164176
content: ""
165-
color: $primary
177+
@include css4
178+
color: var(--primary)
166179
font-size: 25px
167180
margin-left: 2px
168181
margin-top: -4px
@@ -196,7 +209,8 @@ input[type=radio]
196209
&:checked
197210
&::after
198211
content: ""
199-
background: $primary
212+
@include css4
213+
background: var(--primary)
200214
display: block
201215
width: 100%
202216
height: 100%
@@ -221,15 +235,18 @@ input[type=submit]
221235
margin-top: 20px
222236

223237
.field_with_errors
224-
color: $red !important
238+
@include css4
239+
color: var(--red) !important
225240

226241
.hint
227-
color: $input--hint
242+
@include css4
243+
color: var(--input--hint)
228244
font-style: italic
229245
width: 100%
230246

231247
.supporting-text
232-
color: $input--hint
248+
@include css4
249+
color: var(--input--hint)
233250
line-height: 1.5
234251
margin-left: $form-spacing-horizontal
235252
margin-right: $form-spacing-horizontal
@@ -238,17 +255,20 @@ input[type=submit]
238255

239256
// jquery ui override
240257
.ui-autocomplete
241-
background: $input--background--focus
242-
border: 1px solid $input--border-color--focus
243-
color: $input--text--focus
258+
@include css4
259+
background: var(--input--background--focus)
260+
border: 1px solid var(--input--border-color--focus)
261+
color: var(--input--text--focus)
244262
list-style: none
245263
padding: 0
246264
.ui-menu-item a
247265
padding: 2px 5px
248266
display: block
249267
&:hover, &.ui-state-focus
250-
background: $primary
251-
color: $white
268+
@include css4
269+
background: var(--primary)
270+
@include css4
271+
color: var(--white)
252272

253273
// form wizard
254274
.wizard-stage

app/assets/stylesheets/general/_base.sass

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,49 @@ body, html
66
min-height: 250px
77

88
body
9-
background: $white_pure
10-
color: $grey-med
11-
font-family: $font-body-family
9+
@include css4
10+
background: var(--white-pure)
11+
color: var(--grey-med)
12+
font-family: var(--font-body-family)
13+
font-weight: var(--font-light)
1214
font-size: 16px
13-
font-weight: $font-light
1415
margin: 0
1516
padding: 0
1617
overflow-x: hidden
1718

1819
h1, h2, h3
19-
font-family: $font-headlines-family
20+
@include css4
21+
font-family: var(--font-headlines-family)
2022
margin-top: 0
2123
h1
2224
font-size: 2.250rem
23-
font-weight: $font-light
25+
@include css4
26+
font-weight: var(--font-light)
2427
h2
2528
font-size: 2rem
26-
font-weight: $font-bold
29+
@include css4
30+
font-weight: var(--font-bold)
2731
h3
2832
font-size: 1.750rem
29-
font-weight: $font-reg
33+
@include css4
34+
font-weight: var(--font-reg)
3035
margin-top: 0px
3136
h4
32-
font-weight: $font-light
37+
@include css4
38+
font-weight: var(--font-light)
3339

3440
img
3541
max-width: 100%
3642
width: 100%
3743

3844
a
39-
color: $link--text
45+
@include css4
46+
color: var(--link--text)
4047
text-decoration: none
4148
@include transition(100ms, color, ease-out, 0ms)
4249
&:hover
43-
color: $link--text--hover
50+
@include css4
51+
color: var(--link--text--hover)
4452

4553
a.underline
4654
text-decoration: underline
@@ -52,14 +60,17 @@ a.underline
5260
position: relative
5361

5462
.section-title
55-
color: $section-title--text
63+
@include css4
64+
color: var(--section-title--text)
5665
font-size: 2.1rem
5766
line-height: 1.2
5867
text-align: left
5968
&.white
60-
color: $white
69+
@include css4
70+
color: var(--white)
6171
.emphasized
62-
color: $section-title--text--emphasized
72+
@include css4
73+
color: var(--section-title--text--emphasized)
6374

6475
.section-title--actions
6576
display: flex

app/assets/stylesheets/general/_button.sass

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@
33
*/
44

55
.button, input[type=submit]
6-
background: $button--background
7-
border: 1px solid $button--border
6+
@include css4
7+
color: var(--button--text)
8+
background: var(--button--background)
9+
border: 1px solid var(--button--border)
810
cursor: pointer
911
display: inline-block
1012
padding: 0.6em 1.3em
1113
font-size: 15px
1214
text-transform: uppercase
13-
color: $button--text
1415
font-weight: 600
1516
text-align: center
1617
text-decoration: none
1718
-webkit-appearance: none
1819
@include transition(150ms, all, ease-in-out, 0ms)
19-
@include box-shadow(0 2px 15px rgba($button--background, 0.3))
2020
@include border-radius(3px)
21+
@include css4
22+
@include box-shadow(0 2px 15px rgba(var(--button--background), 0.3))
2123

2224
&.button--with-margin
2325
margin: 0.5em 0.5em 0.5em 0
@@ -27,27 +29,31 @@
2729
min-width: initial
2830
padding: 3px 5px
2931
&:hover, &:focus
30-
background: $button--background--hover
31-
border-color: $button--border--hover
32-
color: $button--text--hover
33-
outline-color: $button--background--hover
32+
@include css4
33+
background: var(--button--background--hover)
34+
border-color: var(--button--border--hover)
35+
color: var(--button--text--hover)
36+
outline-color: var(--button--background--hover)
3437
&:disabled
35-
color: lighten($secondary, 40%)
38+
@include css4
39+
color: var(--primary-lightest)
40+
border: 1px solid var(--primary-lightest)
41+
@include box-shadow(inset 0 0 0 0 var(--primary-light))
3642
background: transparent
37-
border: 1px solid lighten($secondary, 35%)
3843
cursor: default
39-
@include box-shadow(inset 0 0 0 0 lighten($secondary, 5%))
4044

4145
.button-center
4246
margin-left: auto
4347
margin-right: auto
4448

4549
.button-outline
4650
background: transparent
47-
border: 1px solid $white_pure
51+
@include css4
52+
border: 1px solid var(--white-pure)
4853
&:hover
49-
outline-color: lighten($secondary, 5%)
50-
border-color: lighten($secondary, 5%)
54+
@include css4
55+
outline-color: var(--primary-light)
56+
border-color: var(--primary-light)
5157

5258
.button-clean
5359
background: transparent
@@ -72,8 +78,9 @@
7278

7379
&:hover
7480
transform: scale(1.04)
75-
background: $button--background
76-
@include box-shadow(0 4px 18px rgba($button--background, 0.35))
81+
@include css4
82+
background: var(--button--background)
83+
@include box-shadow(0 4px 18px rgba(var(--button--background), 0.35))
7784

7885
.my-mlh-cta__text
7986
flex: 1
@@ -85,7 +92,8 @@
8592
display: flex
8693
align-items: center
8794
flex-flow: row nowrap
88-
color: $button--background
95+
@include css4
96+
color: var(--button--background)
8997
padding: 0px 9px
9098
justify-content: center
9199
border-radius: 0 2px 2px 0

0 commit comments

Comments
 (0)