@@ -3,16 +3,13 @@ module Functora.Miso.Widgets.Dialog
3
3
Opts (.. ),
4
4
defOpts ,
5
5
dialog ,
6
- openDialog ,
7
- closeDialog ,
8
6
)
9
7
where
10
8
11
9
import Functora.Miso.Prelude
12
10
import Functora.Miso.Types
13
11
import qualified Functora.Miso.Widgets.FixedOverlay as FixedOverlay
14
12
import qualified Functora.Miso.Widgets.Icon as Icon
15
- import qualified Language.Javascript.JSaddle as JS
16
13
17
14
data Args model action = Args
18
15
{ argsModel :: model ,
@@ -79,7 +76,7 @@ dialog opts args =
79
76
defHeaderLeft =
80
77
maybeToList
81
78
. fmap
82
- ( h2_
79
+ ( h1_
83
80
[ style_
84
81
[ (" margin" , " 0" ),
85
82
(" display" , " flex" ),
@@ -123,7 +120,7 @@ newFlex newTag newAttr lhs rhs =
123
120
]
124
121
)
125
122
$ lhs
126
- <> [ span_
123
+ <> [ div_
127
124
[ style_
128
125
[ (" flex-grow" , " 1" )
129
126
]
@@ -135,45 +132,6 @@ newFlex newTag newAttr lhs rhs =
135
132
closeDialogAction :: Opts model action -> Args model action -> action
136
133
closeDialogAction opts args =
137
134
argsAction args
138
- $ PureAndImpureUpdate
139
- ( optsExtraOnClose opts
140
- . (cloneTraversal (argsOptic args) . # uniqueValue .~ Closed )
141
- )
142
- ( do
143
- closeDialog (argsModel args) (argsOptic args)
144
- pure id
145
- )
146
-
147
- openDialog ::
148
- model ->
149
- ATraversal' model (Unique OpenedOrClosed ) ->
150
- JSM ()
151
- openDialog st optic =
152
- handleAny consoleLog $ do
153
- el <- getElementById $ getDialogUid st optic
154
- elExist <- ghcjsPure $ JS. isTruthy el
155
- when elExist . void $ el ^. JS. js0 (" showModal" :: Unicode )
156
-
157
- closeDialog ::
158
- model ->
159
- ATraversal' model (Unique OpenedOrClosed ) ->
160
- JSM ()
161
- closeDialog st optic =
162
- handleAny consoleLog $ do
163
- el <- getElementById $ getDialogUid st optic
164
- elExist <- ghcjsPure $ JS. isTruthy el
165
- when elExist . void $ el ^. JS. js0 (" close" :: Unicode )
166
-
167
- getDialogUid ::
168
- model ->
169
- ATraversal' model (Unique OpenedOrClosed ) ->
170
- Unicode
171
- getDialogUid st optic =
172
- either impureThrow id
173
- . decodeUtf8Strict
174
- . unTagged
175
- . htmlUid
176
- . fromMaybe nilUid
177
- $ st
178
- ^? cloneTraversal optic
179
- . # uniqueUid
135
+ . PureUpdate
136
+ $ optsExtraOnClose opts
137
+ . (cloneTraversal (argsOptic args) . # uniqueValue .~ Closed )
0 commit comments