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
4646 , borderColor :: String
4747 , className :: String
4848 , content :: Array JSX
49+ , css :: E.Style
4950 }
5051
5152slatDefaults :: SlatProps
@@ -54,6 +55,7 @@ slatDefaults =
5455 , borderColor: " grey"
5556 , className: " "
5657 , content: mempty
58+ , css: mempty
5759 }
5860
5961mkSlat :: Effect (ReactComponent SlatProps )
@@ -62,15 +64,15 @@ mkSlat = do
6264 component " Slat" \props ->
6365 pure
6466 $ E .element
65- ( E .merge
67+ box
68+ { className: props.className
69+ , css:
70+ E .merge
6671 [ border props
6772 , text L
6873 , E .css { flexDirection: E .str " row" }
6974 , spaceChildrenEvenly
7075 ]
71- )
72- box
73- { className: props.className
7476 , content: props.content
7577 }
7678
@@ -85,17 +87,17 @@ mkEx = do
8587 { content = map (R .span_ <<< pure <<< R .text) [ " Hello" , " World" ]
8688 }
8789 , E .element
88- ( E .merge
89- [ E .css
90- { padding: E .int 4
91- , maxWidth: E .int 200
92- }
93- , text S
94- ]
95- )
9690 slat
9791 slatDefaults
9892 { 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+ ]
99101 }
100102 ]
101103
@@ -123,8 +125,9 @@ mkBox :: Effect (ReactComponent BoxProps)
123125mkBox = do
124126 component " Box" \props ->
125127 pure
126- $ E .element boxStyle R .div'
128+ $ E .element R .div'
127129 { className: props.className
130+ , css: boxStyle
128131 , children: props.content
129132 }
130133
Original file line number Diff line number Diff line change @@ -26,11 +26,8 @@ import Control.Monad.Except (runExcept)
2626import Data.Array as Array
2727import Data.Either (Either (..))
2828import Data.Function.Uncurried (Fn2 , runFn2 )
29- import Data.Symbol (SProxy (..))
3029import Foreign as F
31- import Prim.Row (class Lacks )
3230import React.Basic (JSX , ReactComponent )
33- import Record as Record
3431import Type.Row.Homogeneous (class Homogeneous )
3532import Unsafe.Coerce (unsafeCoerce )
3633import Web.HTML.History (URL (..))
@@ -87,12 +84,10 @@ class IsStyleProperty a where
8784-- | `css` prop.
8885element ::
8986 forall props .
90- Lacks " css" props =>
91- Style ->
9287 ReactComponent { className :: String | props } ->
93- { className :: String | props } ->
88+ { className :: String , css :: Style | props } ->
9489 JSX
95- element s c p = runFn2 element_ c ( Record .insert ( SProxy :: _ " css " ) s p)
90+ element = runFn2 element_
9691
9792foreign import element_ ::
9893 forall props .
You can’t perform that action at this time.
0 commit comments