Skip to content

Commit d65618c

Browse files
committed
better fixedOverlay widget
1 parent 0e33bd8 commit d65618c

File tree

3 files changed

+33
-16
lines changed

3 files changed

+33
-16
lines changed

ghcjs/miso-functora/src/Functora/Miso/Widgets/Dialog.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ dialog opts args =
5353
else
5454
singleton
5555
. FixedOverlay.fixedOverlay
56+
[ role_ "button",
57+
onClick $ closeDialogAction opts args
58+
]
5659
. singleton
5760
. nodeHtml "dialog" [boolProp "open" True]
5861
$ newFlex

ghcjs/miso-functora/src/Functora/Miso/Widgets/FixedOverlay.hs

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,33 @@ where
55

66
import Functora.Miso.Prelude
77

8-
fixedOverlay :: [View action] -> View action
9-
fixedOverlay =
8+
fixedOverlay :: [Attribute action] -> [View action] -> View action
9+
fixedOverlay attrs content =
1010
div_
11-
. singleton
12-
$ style_
13-
[ ("position", "fixed"),
14-
("top", "0"),
15-
("left", "0"),
16-
("width", "100%"),
17-
("height", "100%"),
18-
("backdrop-filter", "blur(2px)"),
19-
("background-color", "rgba(0, 0, 0, 0.5)"),
20-
("z-index", "9999"),
21-
("display", "flex"),
22-
("justify-content", "center"),
23-
("align-items", "center")
24-
]
11+
[ style_
12+
[ ("position", "fixed"),
13+
("top", "0"),
14+
("left", "0"),
15+
("width", "100%"),
16+
("height", "100%"),
17+
("backdrop-filter", "blur(2px)"),
18+
("background-color", "rgba(0, 0, 0, 0.5)"),
19+
("z-index", "9999"),
20+
("display", "flex"),
21+
("justify-content", "center"),
22+
("align-items", "center")
23+
]
24+
]
25+
$ ( div_
26+
( style_
27+
[ ("position", "fixed"),
28+
("top", "0"),
29+
("left", "0"),
30+
("width", "100%"),
31+
("height", "100%")
32+
]
33+
: attrs
34+
)
35+
mempty
36+
)
37+
: content

ghcjs/miso-functora/src/Functora/Miso/Widgets/Spinner.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ import Functora.Miso.Widgets.FixedOverlay as FixedOverlay
99
spinner :: View action
1010
spinner =
1111
FixedOverlay.fixedOverlay
12+
mempty
1213
[ div_ [class_ "lds-dual-ring"] mempty
1314
]

0 commit comments

Comments
 (0)