You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// the stylesets can be much more advanced, this is an example most similar to CSS
47
-
myClass: {
48
-
color: 'white'
49
-
},
50
-
anotherClass: {
51
-
color: 'black'
52
-
}
53
-
});
54
-
```
55
-
see [Examples](#project/jhudson8/react-css-builder/section/Examples) to see all available options including, importing external stylesets, using mixins, variable references and nested styles.
44
+
See [Creating a stylesheet](#project/jhudson8/react-css-builder/section/Usage/Creating%20a%20stylesheet) for more details.
45
+
56
46
57
47
#### vars(varsObject)
58
48
****varsObject***: a hash of variables to register which will be available to styleset rules (using this.get("varName")).
59
49
60
-
```
61
-
var css = require('react-css-builder');
62
-
css.vars({
63
-
primaryColor: 'white'
64
-
});
50
+
See [variables usage](#project/jhudson8/react-css-builder/section/Usage/Variables) for more details.
51
+
65
52
66
-
// variables available using this.get within a stylesheet rule function
67
-
css.register('my-styleset-namespace', {
68
-
myClass: function() {
69
-
return color: this.get('primaryColor')
70
-
}
71
-
});
72
-
```
73
53
#### mixin(mixinName, mixinFunction)
74
54
****mixinName***: the name of the mixin
75
55
****mixinFunction***: the mixin function which can take any number of arguments
76
56
77
57
The mixin can be included in a styleset function. It should return an object represent all style attributes which should be included.
See [Creating a stylesheet](#project/jhudson8/react-css-builder/section/Usage/Creating%20a%20stylesheet) for more details
72
+
122
73
123
74
#### get(className)
124
75
****className***: return the styleset object matching the className key which can be used for associated with a React component ```style``` property.
@@ -127,34 +78,30 @@ Very much like the previously described ```css``` method but allows for addition
127
78
128
79
Returns a [StylesetBuilder](#project/jhudson8/react-css-builder/package/StylesetBuilder)
129
80
130
-
```
131
-
var stylesheet = require('...').register(...)
132
-
stylesheet.get('myStyle')
133
-
.vars({
134
-
foo: 'this var will be available in the styleset function / mixin function as this.get("foo")'
135
-
})
136
-
.attr({
137
-
content: 'this will be an additional attribute included in the returned styleset'
138
-
})
139
-
// this returns the styleset value
140
-
.css();
141
-
```
81
+
See [styleset definitions](#project/jhudson8/react-css-builder/section/Usage/Styleset%20Definitions) for more details.
82
+
142
83
143
84
#### mixin(mixinName, mixinFunction)
144
85
****mixinName***: the name of the mixin
145
86
****mixinFunction***: the mixin function which can take any number of arguments
146
87
147
88
Exactly the same as [react-css-builder mixin](#project/jhudson8/react-css-builder/method/react-css-builder/mixin) except that the mixin registered will *only* be accessable to this particular stylesheet.
148
89
90
+
See [mixin usage](#project/jhudson8/react-css-builder/section/Usage/Mixins) for details.
91
+
92
+
149
93
#### vars(varsObject)
150
94
****varsObject***: a hash of variables to register which will be available to styleset rules (using this.get("varName")).
151
95
152
96
Exactly the same as [react-css-builder vars](l#project/jhudson8/react-css-builder/method/react-css-builder/vars) except that the provided variables will *only* be accessable to this particular stylesheet.
153
97
98
+
See [variables usage](#project/jhudson8/react-css-builder/section/Usage/Variables) for more details.
99
+
154
100
155
101
### StylesetBuilder
156
102
This is the object returned when calling ```get``` from a [StylesetBuilder](#project/jhudson8/react-css-builder/package/StylesetBuilder). It is used to apply variables and attributes to a styleset request.
157
103
104
+
158
105
#### attr(styleAttributes)
159
106
****styleAttributes***: Additional attributes that should be included with the attributes defined with the styleset defined by the class name.
160
107
@@ -168,70 +115,35 @@ var myStyle = stylesheet.get('myStyleClass').attr({color: 'white'}).css();
168
115
// will be {color: 'white', backgroundColor: 'black'}
169
116
```
170
117
118
+
171
119
#### vars(variables)
172
120
****variables***: Object specifying additional variables to be made accessable to the styleset function or referenced mixin functions as ```this.get("varName")```
173
121
174
-
```
175
-
var stylesheet = require('...').register({
176
-
myStyleClass: function() {
177
-
var radius = this.get('radius');
178
-
return {
179
-
borderRadius: radius,
180
-
WebkitBorderRadius: radius
181
-
}
182
-
}
183
-
});
184
-
var myStyle = stylesheet.get('myStyleClass').var({radius: 3}).css();
185
-
// will be {borderRadius: 3, WebkitBorderRadius: 3}
186
-
```
122
+
See [variables usage](#project/jhudson8/react-css-builder/section/Usage/Variables) for more details.
123
+
187
124
188
125
### StyleContext
189
-
This is the object provided as the single argument a styleset if the styleset value is a function rather than a simple object specifying the style attributes.
126
+
This is the object provided as the single styleset if the styleset value is a function rather than a simple object specifying the style attributes.
127
+
128
+
See [styleset definitions](#project/jhudson8/react-css-builder/section/Usage/Styleset%20Definitions) for more details.
129
+
190
130
191
131
#### include(stylesetName)
192
132
****stylesetName***: the name of a styleset in the current stylesheet or, if prefixed with the namespace separated by a ```.```, the name of a styleset in another stylesheet.
193
133
194
134
Include all of the attributes defined by another styleset.
195
135
196
-
```
197
-
var stylesheet = require('...').register({
198
-
anotherStyleClass: {
199
-
color: 'white'
200
-
},
201
-
myStyleClass: function(css) {
202
-
return css
203
-
.include('anotherStyleClass')
204
-
.val();
205
-
}
206
-
});
207
-
var myStyle = stylesheet.css('myStyleClass');
208
-
// will be {color: 'white'}
209
-
```
136
+
See [include usage](#project/jhudson8/react-css-builder/section/Usage/Includes) for more details.
137
+
210
138
211
139
#### mixin(mixinName[, mixinParameters])
212
140
****mixinName***: the name of a registered mixin to include
213
141
****mixinParameters***: any number of parameters that the mixin is expecting
214
142
215
143
Include all of the attributes returned by a registered by a mixin
0 commit comments