File tree 2 files changed +33
-4
lines changed
2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change
1
+ module Test.Container where
2
+
3
+ import Prelude
4
+
5
+ import React
6
+
7
+ import qualified React.DOM as D
8
+ import qualified React.DOM.Props as P
9
+
10
+ container = mkUI $ spec unit \ctx -> do
11
+ children <- getChildren ctx
12
+
13
+ let ui = D .div [ P .style { borderColor: " red"
14
+ , borderWidth: 2
15
+ , padding: 10
16
+ }
17
+ ] children
18
+
19
+ return ui
Original file line number Diff line number Diff line change @@ -10,16 +10,18 @@ import React
10
10
import qualified React.DOM as D
11
11
import qualified React.DOM.Props as P
12
12
13
- foreign import interval :: forall eff a .
14
- Int ->
13
+ import Test.Container (container )
14
+
15
+ foreign import interval :: forall eff a .
16
+ Int ->
15
17
Eff eff a ->
16
18
Eff eff Unit
17
19
18
20
hello = mkUI $ spec unit \ctx -> do
19
21
props <- getProps ctx
20
22
return $ D .h1 [ P .className " Hello"
21
23
, P .style { background: " lightgray" }
22
- ]
24
+ ]
23
25
[ D .text " Hello, "
24
26
, D .text props.name
25
27
]
@@ -44,5 +46,13 @@ counter = mkUI counterSpec
44
46
]
45
47
46
48
main = do
47
- let component = D .div' [ hello { name: " World" }, counter unit ]
49
+ let component = D .div' [
50
+ hello { name: " World" },
51
+ counter unit,
52
+ createElement container unit [
53
+ D .p [] [ D .text " This is line one" ],
54
+ D .p [] [ D .text " This is line two" ]
55
+ ]
56
+ ]
57
+
48
58
renderToBody component
You can’t perform that action at this time.
0 commit comments