File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -30,15 +30,18 @@ type ComponentM m
30
30
= Halogen.HalogenM State Action ChildSlot Output m
31
31
32
32
type State
33
- = { copied :: Boolean }
33
+ = { copied :: Boolean
34
+ , input :: Input
35
+ }
34
36
35
37
data Action
36
38
= Copy
39
+ | Receive Input
37
40
38
41
data Query (a :: Type )
39
42
40
43
type Input
41
- = Unit
44
+ = { text :: String }
42
45
43
46
type Output
44
47
= Void
@@ -56,14 +59,16 @@ component =
56
59
Halogen .mkEval
57
60
Halogen .defaultEval
58
61
{ handleAction = handleAction
62
+ , receive = Just <<< Receive
59
63
}
60
64
, initialState
61
65
, render
62
66
}
63
67
64
68
initialState :: Input -> State
65
- initialState _ =
69
+ initialState input =
66
70
{ copied: false
71
+ , input
67
72
}
68
73
69
74
handleAction ::
@@ -73,6 +78,7 @@ handleAction ::
73
78
ComponentM m Unit
74
79
handleAction = case _ of
75
80
Copy -> copy
81
+ Receive input -> receive input
76
82
77
83
copy ::
78
84
forall m .
@@ -85,6 +91,13 @@ copy = do
85
91
$ Effect.Aff .delay (Effect.Aff.Milliseconds 1000.0 )
86
92
Halogen .modify_ _ { copied = false }
87
93
94
+ receive ::
95
+ forall m .
96
+ Input ->
97
+ ComponentM m Unit
98
+ receive input = do
99
+ Halogen .modify_ _ { input = input }
100
+
88
101
render ::
89
102
forall m .
90
103
State ->
Original file line number Diff line number Diff line change @@ -413,7 +413,7 @@ renderClipboardButtons =
413
413
[ HH .text " Standard" ]
414
414
, HH .slot_ _clipboard unit
415
415
Ocelot.Clipboard .component
416
- unit
416
+ { text: " copied from UIGuide " }
417
417
]
418
418
]
419
419
]
You can’t perform that action at this time.
0 commit comments