UNPKG

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