UNPKG

2.96 kBSCSSView Raw
1@import 'restyle';
2
3%extend-test {
4 extended: true;
5}
6
7@include restyle-add-state((
8 hover: '&:hover, &.hover, &:focus, &.focus'
9));
10
11@function custom-border($border, $opacity) {
12 @return (
13 border: $border,
14 border-color: rgba(nth($border, 3), $opacity)
15 );
16}
17
18@include restyle-define(tester, (
19 color: multiple-values(
20 red,
21 rgba(red, 0.8)
22 ),
23 multivalues: multiple-values(
24 -webkit-true,
25 true,
26 '@var.simple',
27 '@this.color'
28 ),
29 multivalues2: '@this.multivalues',
30
31 '@restyle.function custom-border': (2px solid red, 0.8),
32
33 font-size: 10px,
34 '@restyle.var simple': simple,
35
36 '&.test': (
37 test: '@var.simple',
38 color: '@root.color',
39 '& > .child': (
40 'color{1}': '@root.color',
41 'color{2}': '@this.@parent.color',
42 'color{3}': '@this.@parent.@parent.color',
43 color\4: '@this.@parent.@parent.color'
44 ),
45
46 '@restyle.states': (
47 hover: (
48 test: '@var.simple',
49 color: '@this.@parent.color',
50 nested-state: true
51 )
52 )
53 ),
54
55 '@restyle.states': (
56 hover: (
57 color: purple,
58
59 '& .sub': (
60 color: orange,
61 nested-selector: true
62 )
63 )
64 )
65));
66
67@include restyle-define(button, (
68 color: green,
69 font-size: 14px,
70 border: 1px solid red,
71 font-color: '@this.border-color',
72 border-color: '@this.color',
73
74 border-radius: 5px nomixin,
75
76 content: "should be quoted",
77
78 '@extend': '%extend-test',
79
80 '@restyle.var foo': pink,
81 '@restyle.var bar': '@this.color',
82
83 // modifiers...
84 '@restyle.modifiers': (
85 small: (
86 font-size: 12px,
87 '@restyle.var foo': purple
88 ),
89 in a container: (
90 color: '@var.foo',
91 font-color: '@var.bar',
92 border: null
93 ),
94
95 // test an alias
96 close: (
97 '@restyle.alias': close-button // this is equivalent to doing `restyle(close-button)`
98 )
99 ),
100 // states...
101 '@restyle.states': (
102 hover: (
103 color: white
104 ),
105 '&.one-off-custom-state': (
106 color: blue
107 )
108 )
109));
110
111@include restyle-define(close-button, (
112 font-size: 2em
113));
114
115// we need to register these components so that the grammar engine is aware of them
116@include restyle-define(dialog);
117@include restyle-define(container);
118
119
120.should-be-large-primary-button {
121 @include restyle('large primary button');
122}
123
124.should-be-large-primary-button {
125 @include restyle(large primary button);
126}
127
128.should-be-close-button-in-dialog {
129 @include restyle(close-button in a dialog);
130}
131
132.should-be-small-button-in-container {
133 @include restyle((description: small button in a container));
134}
135
136.should-be-small-button-in-container {
137 @include restyle((type: button, description: small in a container));
138}
139
140.should-be-button-with-content {
141 @include restyle(button) {
142 color: red;
143 }
144}
145
146.should-be-close-button {
147 @include restyle(small close button);
148}
149
150.should-be-close-button {
151 @include restyle(close-button);
152}
153
154.should-be-a-tester {
155 @include restyle(tester);
156}