Skip to content

Commit f918738

Browse files
committed
Add more style prop helpers
1 parent 5e9af89 commit f918738

File tree

1 file changed

+108
-4
lines changed

1 file changed

+108
-4
lines changed

Diff for: src/React/Basic/Emotion.purs

+108-4
Original file line numberDiff line numberDiff line change
@@ -162,20 +162,124 @@ num = unsafeCoerce
162162
fallbacks :: Array StyleProperty -> StyleProperty
163163
fallbacks = unsafeCoerce
164164

165+
url :: URL -> StyleProperty
166+
url (URL url') = str ("url(" <> url' <> ")")
167+
168+
color :: Color -> StyleProperty
169+
color = str <<< cssStringHSLA
170+
165171
none :: StyleProperty
166172
none = str "none"
167173

174+
auto :: StyleProperty
175+
auto = str "auto"
176+
168177
inherit :: StyleProperty
169178
inherit = str "inherit"
170179

171180
unset :: StyleProperty
172181
unset = str "unset"
173182

174-
url :: URL -> StyleProperty
175-
url (URL url') = str ("url(" <> url' <> ")")
183+
hidden :: StyleProperty
184+
hidden = str "hidden"
176185

177-
color :: Color -> StyleProperty
178-
color = str <<< cssStringHSLA
186+
visible :: StyleProperty
187+
visible = str "visible"
188+
189+
scroll :: StyleProperty
190+
scroll = str "scroll"
191+
192+
wrap :: StyleProperty
193+
wrap = str "wrap"
194+
195+
nowrap :: StyleProperty
196+
nowrap = str "nowrap"
197+
198+
row :: StyleProperty
199+
row = str "row"
200+
201+
column :: StyleProperty
202+
column = str "column"
203+
204+
default :: StyleProperty
205+
default = str "default"
206+
207+
manipulation :: StyleProperty
208+
manipulation = str "manipulation"
209+
210+
pointer :: StyleProperty
211+
pointer = str "pointer"
212+
213+
solid :: StyleProperty
214+
solid = str "solid"
215+
216+
ellipsis :: StyleProperty
217+
ellipsis = str "ellipsis"
218+
219+
block :: StyleProperty
220+
block = str "block"
221+
222+
inlineBlock :: StyleProperty
223+
inlineBlock = str "inline-block"
224+
225+
flex :: StyleProperty
226+
flex = str "flex"
227+
228+
grid :: StyleProperty
229+
grid = str "grid"
230+
231+
inlineGrid :: StyleProperty
232+
inlineGrid = str "inline-grid"
233+
234+
inlineFlex :: StyleProperty
235+
inlineFlex = str "inline-flex"
236+
237+
flexStart :: StyleProperty
238+
flexStart = str "flex-start"
239+
240+
flexEnd :: StyleProperty
241+
flexEnd = str "flex-end"
242+
243+
center :: StyleProperty
244+
center = str "center"
245+
246+
stretch :: StyleProperty
247+
stretch = str "stretch"
248+
249+
baseline :: StyleProperty
250+
baseline = str "baseline"
251+
252+
spaceAround :: StyleProperty
253+
spaceAround = str "space-around"
254+
255+
spaceBetween :: StyleProperty
256+
spaceBetween = str "space-between"
257+
258+
spaceEvenly :: StyleProperty
259+
spaceEvenly = str "space-evenly"
260+
261+
minContent :: StyleProperty
262+
minContent = str "min-content"
263+
264+
maxContent :: StyleProperty
265+
maxContent = str "max-content"
266+
267+
preWrap :: StyleProperty
268+
preWrap = str "pre-wrap"
269+
270+
-- | Use a variable name as a property.
271+
-- |
272+
-- | Define a property somewhere:
273+
-- | ```
274+
-- | css { "--color-primary": color blue }
275+
-- | ```
276+
-- |
277+
-- | Use the var:
278+
-- | ```
279+
-- | css { color: var "--color-primary" }
280+
-- | ```
281+
var :: String -> StyleProperty
282+
var n = str ("var(" <> n <> ")")
179283

180284
-- Absolute length units
181285

0 commit comments

Comments
 (0)