Skip to content

Commit 8bcbc0b

Browse files
committed
wip
1 parent 6b54d61 commit 8bcbc0b

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

ghcjs/delivery-calculator/src/App/Widgets/Menu.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ menu st =
108108
<> Fav.fav st
109109
<> Dialog.dialog
110110
( Dialog.defOpts
111+
& #optsTitleIcon
112+
.~ Just Icon.IconSettings
111113
& #optsTitle
112114
.~ Just "Settings"
113115
)

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

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ data Args model action = Args
2121

2222
data Opts model action = Opts
2323
{ optsTitle :: Maybe Unicode,
24+
optsTitleIcon :: Maybe Icon.Icon,
2425
optsHeaderLeft :: [View action] -> [View action],
2526
optsHeaderRight :: [View action] -> [View action],
2627
optsFooterLeft :: [View action] -> [View action],
@@ -34,6 +35,7 @@ defOpts :: Opts model action
3435
defOpts =
3536
Opts
3637
{ optsTitle = Nothing,
38+
optsTitleIcon = Nothing,
3739
optsHeaderLeft = id,
3840
optsHeaderRight = id,
3941
optsFooterLeft = id,
@@ -72,20 +74,30 @@ dialog opts args =
7274
where
7375
opened =
7476
args ^? #argsModel . cloneTraversal (argsOptic args) == Just Opened
77+
defHeaderStyle =
78+
style_
79+
[ ("margin", "0"),
80+
("display", "flex"),
81+
("align-items", "center")
82+
]
7583
defHeaderLeft =
7684
maybeToList
77-
. fmap
78-
( h1_
79-
[ style_
80-
[ ("margin", "0"),
81-
("display", "flex"),
82-
("align-items", "center")
83-
]
84-
]
85-
. singleton
86-
. text
85+
( fmap
86+
( h1_
87+
[ defHeaderStyle,
88+
style_ [("margin-right", "0.5em")]
89+
]
90+
. singleton
91+
. optsIcon opts
92+
)
93+
$ optsTitleIcon opts
94+
)
95+
<> maybeToList
96+
( fmap
97+
( h1_ [defHeaderStyle] . singleton . text
98+
)
99+
$ optsTitle opts
87100
)
88-
$ optsTitle opts
89101
defHeaderRight =
90102
[ button_
91103
[onClick $ closeDialogAction opts args]

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ data Icon
1919
| IconQr
2020
| IconDelivery
2121
| IconBack
22+
| IconSettings
2223
deriving stock (Eq, Ord, Show, Read, Data, Generic, Enum, Bounded)
2324

2425
class (From Icon a) => IsIcon a where
@@ -35,6 +36,7 @@ data Fa
3536
| FaQrcode
3637
| FaTruck
3738
| FaArrowLeft
39+
| FaGear
3840
deriving stock (Eq, Ord, Show, Read, Data, Generic, Enum, Bounded)
3941

4042
instance From Icon Fa where
@@ -49,6 +51,7 @@ instance From Icon Fa where
4951
IconQr -> FaQrcode
5052
IconDelivery -> FaTruck
5153
IconBack -> FaArrowLeft
54+
IconSettings -> FaGear
5255

5356
instance IsIcon Fa where
5457
icon x =

0 commit comments

Comments
 (0)