File tree Expand file tree Collapse file tree 2 files changed +18
-20
lines changed Expand file tree Collapse file tree 2 files changed +18
-20
lines changed Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ type SlatProps
46
46
, borderColor :: String
47
47
, className :: String
48
48
, content :: Array JSX
49
+ , css :: E.Style
49
50
}
50
51
51
52
slatDefaults :: SlatProps
@@ -54,6 +55,7 @@ slatDefaults =
54
55
, borderColor: " grey"
55
56
, className: " "
56
57
, content: mempty
58
+ , css: mempty
57
59
}
58
60
59
61
mkSlat :: Effect (ReactComponent SlatProps )
@@ -62,15 +64,15 @@ mkSlat = do
62
64
component " Slat" \props ->
63
65
pure
64
66
$ E .element
65
- ( E .merge
67
+ box
68
+ { className: props.className
69
+ , css:
70
+ E .merge
66
71
[ border props
67
72
, text L
68
73
, E .css { flexDirection: E .str " row" }
69
74
, spaceChildrenEvenly
70
75
]
71
- )
72
- box
73
- { className: props.className
74
76
, content: props.content
75
77
}
76
78
@@ -85,17 +87,17 @@ mkEx = do
85
87
{ content = map (R .span_ <<< pure <<< R .text) [ " Hello" , " World" ]
86
88
}
87
89
, E .element
88
- ( E .merge
89
- [ E .css
90
- { padding: E .int 4
91
- , maxWidth: E .int 200
92
- }
93
- , text S
94
- ]
95
- )
96
90
slat
97
91
slatDefaults
98
92
{ content = map (R .span_ <<< pure <<< R .text) [ " Hello" , " World" ]
93
+ , css =
94
+ E .merge
95
+ [ E .css
96
+ { padding: E .int 4
97
+ , maxWidth: E .int 200
98
+ }
99
+ , text S
100
+ ]
99
101
}
100
102
]
101
103
@@ -123,8 +125,9 @@ mkBox :: Effect (ReactComponent BoxProps)
123
125
mkBox = do
124
126
component " Box" \props ->
125
127
pure
126
- $ E .element boxStyle R .div'
128
+ $ E .element R .div'
127
129
{ className: props.className
130
+ , css: boxStyle
128
131
, children: props.content
129
132
}
130
133
Original file line number Diff line number Diff line change @@ -26,11 +26,8 @@ import Control.Monad.Except (runExcept)
26
26
import Data.Array as Array
27
27
import Data.Either (Either (..))
28
28
import Data.Function.Uncurried (Fn2 , runFn2 )
29
- import Data.Symbol (SProxy (..))
30
29
import Foreign as F
31
- import Prim.Row (class Lacks )
32
30
import React.Basic (JSX , ReactComponent )
33
- import Record as Record
34
31
import Type.Row.Homogeneous (class Homogeneous )
35
32
import Unsafe.Coerce (unsafeCoerce )
36
33
import Web.HTML.History (URL (..))
@@ -87,12 +84,10 @@ class IsStyleProperty a where
87
84
-- | `css` prop.
88
85
element ::
89
86
forall props .
90
- Lacks " css" props =>
91
- Style ->
92
87
ReactComponent { className :: String | props } ->
93
- { className :: String | props } ->
88
+ { className :: String , css :: Style | props } ->
94
89
JSX
95
- element s c p = runFn2 element_ c ( Record .insert ( SProxy :: _ " css " ) s p)
90
+ element = runFn2 element_
96
91
97
92
foreign import element_ ::
98
93
forall props .
You can’t perform that action at this time.
0 commit comments