UNPKG

3.67 kBSCSSView Raw
1@import 'restyle';
2
3@include restyle-add-state(hover, '&:hover, &.hover, &:focus, &.focus');
4
5@include restyle-define(test, (
6 color: red,
7 margin: 5px,
8 font-size: 10px,
9 border-color: this(color),
10
11 // some variables
12 restyle-var(simple): simple,
13
14 '&.test': (
15 simple: restyle-var(simple),
16 color: root(color),
17
18 '& > .child': (
19 restyle-var(simple): simple2,
20 color1: this(root(color)),
21 color2: this(parent(color)),
22 color3: this(parent(parent(color))),
23 simple: restyle-var(simple)
24 ),
25
26 restyle-states: (
27 hover: (
28 test: restyle-var(simple),
29 color: this(parent(color))
30 )
31 )
32 ),
33
34 restyle-modifiers: (
35 fancy: (
36 color: green,
37 margin: null,
38 simple: restyle-var(simple),
39 ),
40 simple: (
41 color: null,
42 '&.test': null
43 ),
44 single-nested-restyle: (
45 restyle: simple test
46 ),
47 nested-restyle: (
48 restyle: (simple test, fancy test),
49 font-size: 16px // test overriding a property from a nested restyle
50 ),
51 null-nested-restyle: (
52 restyle: null
53 ),
54 inherit-fancy: (
55 restyle-extends: fancy
56 )
57 ),
58
59 restyle-states: (
60 hover: (
61 color: purple,
62
63 '& .sub': (
64 color: orange
65 )
66 )
67 )
68));
69
70.should-be-test {
71 @include restyle(test);
72}
73
74.should-be-fancy-test {
75 @include restyle(fancy test);
76}
77
78.should-be-fancy-test {
79 @include restyle('fancy test');
80}
81
82.should-be-simple-test {
83 @include restyle(simple test);
84}
85
86.should-be-simple-test-and-fancy-test {
87 @include restyle(simple test, fancy test);
88}
89
90.should-be-simple-fancy-test {
91 @include restyle(simple fancy test);
92}
93
94.should-be-fancy-simple-test {
95 @include restyle(fancy simple test);
96}
97
98.should-be-simple-test {
99 @include restyle(single-nested-restyle test);
100}
101
102.should-be-simple-test-and-fancy-test {
103 @include restyle(nested-restyle test);
104}
105
106.should-be-fancy-test {
107 @include restyle(inherit-fancy test);
108}
109
110.null-nested-restyle{
111 @include restyle(null-nested-restyle test);
112}
113
114
115
116
117@include restyle-define(selectorTest, (
118 '&::before': (
119 color: green
120 ),
121
122 restyle-modifiers: (
123 selectorA: (
124 '&::before': (
125 color: red
126 )
127 ),
128 selectorB: (
129 '&::before': (
130 color: blue
131 )
132 )
133 )
134));
135
136.should-be-selectorTest-green {
137 @include restyle(selectorTest);
138}
139
140.should-be-selectorTest-red {
141 @include restyle(selectorA selectorTest);
142}
143
144.should-be-selectorTest-blue {
145 @include restyle(selectorB selectorTest);
146}
147
148.should-be-selectorTest-blue {
149 @include restyle(selectorA selectorB selectorTest);
150}
151
152
153@include restyle-define(headline, (
154 color: blue,
155 font-weight: bold,
156 text-transform: uppercase,
157 font-family: sans-serif,
158
159 restyle-modifiers: (
160 large: (
161 padding-top: 0,
162 position: relative,
163 font-size: 50px,
164 // add a nifty separator bar
165 '&::before': (
166 background-color: blue,
167 bottom: 12px,
168 content: "",
169 height: 8px,
170 left: 0,
171 position: absolute,
172 right: 0
173 ),
174 '& > another': (
175 color: green,
176 height: 100%
177 )
178 ),
179
180 full-width: (
181 color: red,
182 '&::before': (
183 position: static,
184 left: -100%,
185 right: -100%,
186 color: green
187 ),
188 '& > another': (
189 color: pink
190 )
191 )
192 )
193));
194
195
196.should-be-headline {
197 @include restyle(headline);
198}
199
200.should-be-headline-large {
201 @include restyle(large headline);
202}
203
204.should-be-headline-fullwidth {
205 @include restyle(full-width headline);
206}
207
208.should-be-headline-large-fullwidth {
209 @include restyle(large full-width headline);
210}