Skip to content

Commit d5b1547

Browse files
committed
wip
1 parent 41f0461 commit d5b1547

File tree

10 files changed

+190
-140
lines changed

10 files changed

+190
-140
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ assetViewer st idx =
3535
]
3636
]
3737
]
38-
<> FieldPairs.fieldPairsViewer args
38+
<> FieldPairs.fieldPairsViewer FieldPairs.defOpts args
3939
]
4040
<> ( Dialog.dialog
4141
( Dialog.defOpts @Model @Action

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import qualified Functora.Miso.Jsm as Jsm
1010
import Functora.Miso.Prelude
1111
import qualified Functora.Miso.Widgets.Dialog as Dialog
1212
import qualified Functora.Miso.Widgets.Field as Field
13+
import qualified Functora.Miso.Widgets.Icon as Icon
1314

1415
fav :: Model -> [View Action]
1516
fav st =
@@ -34,7 +35,7 @@ fav st =
3435
Field.optsTrailingWidget =
3536
let w =
3637
Field.ActionWidget
37-
"favorite"
38+
Icon.IconFav
3839
mempty
3940
. PushUpdate
4041
$ Instant saveAction
@@ -43,7 +44,7 @@ fav st =
4344
Field.optsLeadingWidget =
4445
let w =
4546
Field.ActionWidget
46-
"delete_forever"
47+
Icon.IconDelete
4748
mempty
4849
deleteAction
4950
in Just

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ screenWidget st@Model {modelState = St {stScreen = QrCode sc}} =
5757
then mempty
5858
else
5959
Field.fieldViewer
60+
Field.defOpts
6061
Field.Args
6162
{ Field.argsModel = st,
6263
Field.argsOptic = #modelState . #stPreview,
@@ -65,6 +66,7 @@ screenWidget st@Model {modelState = St {stScreen = QrCode sc}} =
6566
}
6667
)
6768
<> FieldPairs.fieldPairsViewer
69+
FieldPairs.defOpts
6870
FieldPairs.Args
6971
{ FieldPairs.argsModel = st,
7072
FieldPairs.argsOptic = #modelUriViewer,
@@ -79,6 +81,7 @@ screenWidget st@Model {modelState = St {stScreen = QrCode sc}} =
7981
]
8082
screenWidget st@Model {modelState = St {stScreen = Donate}} =
8183
FieldPairs.fieldPairsViewer
84+
FieldPairs.defOpts
8285
FieldPairs.Args
8386
{ FieldPairs.argsModel = st,
8487
FieldPairs.argsOptic = #modelDonateViewer,
@@ -135,6 +138,7 @@ totalViewer st =
135138
[ h1_ mempty [text "Total"]
136139
]
137140
<> FieldPairs.fieldPairsViewer
141+
FieldPairs.defOpts
138142
FieldPairs.Args
139143
{ FieldPairs.argsModel = st,
140144
FieldPairs.argsOptic =

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

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,17 @@ import qualified Functora.Miso.Widgets.BrowserLink as BrowserLink
1414
import qualified Functora.Miso.Widgets.Currency as Currency
1515
import qualified Functora.Miso.Widgets.Dialog as Dialog
1616
import qualified Functora.Miso.Widgets.Field as Field
17+
import qualified Functora.Miso.Widgets.Flex as Flex
1718
import qualified Functora.Miso.Widgets.Icon as Icon
1819
import qualified Functora.Miso.Widgets.Select as Select
1920
import qualified Functora.Money as Money
2021
import qualified Text.URI as URI
2122

2223
menu :: Model -> [View Action]
2324
menu st =
24-
[ menu_
25-
[ class_ "no-print",
26-
style_
27-
[ ("display", "flex"),
28-
("flex-wrap", "wrap"),
29-
("flex-direction", "row"),
30-
("justify-content", "space-between")
31-
]
32-
]
25+
( Flex.flexLeftRight
26+
menu_
27+
id
3328
[ li_
3429
[ role_ "button",
3530
onClick
@@ -48,12 +43,9 @@ menu st =
4843
pure $ #modelState .~ doc
4944
]
5045
[ text "Delivery Calculator"
51-
],
52-
div_
53-
[ style_ [("flex-grow", "1")]
5446
]
55-
mempty,
56-
li_
47+
]
48+
[ li_
5749
[ role_ "button",
5850
onClick
5951
. PushUpdate
@@ -104,7 +96,7 @@ menu st =
10496
[ icon Icon.IconShare
10597
]
10698
]
107-
]
99+
)
108100
<> Fav.fav st
109101
<> Dialog.dialog
110102
( Dialog.defOpts
@@ -267,7 +259,7 @@ qrButton st =
267259
[ icon
268260
$ if isQrCode sc
269261
then Icon.IconDelivery
270-
else Icon.IconQr,
262+
else Icon.IconQrCode,
271263
text
272264
$ if isQrCode sc
273265
then " Calculator"

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

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ where
99
import Functora.Miso.Prelude
1010
import Functora.Miso.Types
1111
import qualified Functora.Miso.Widgets.FixedOverlay as FixedOverlay
12+
import qualified Functora.Miso.Widgets.Flex as Flex
1213
import qualified Functora.Miso.Widgets.Icon as Icon
1314

1415
data Args model action = Args
@@ -60,13 +61,13 @@ dialog opts args =
6061
]
6162
. singleton
6263
. nodeHtml "dialog" [boolProp "open" True]
63-
$ newFlex
64+
$ Flex.flexLeftRight
6465
header_
6566
id
6667
(optsHeaderLeft opts defHeaderLeft)
6768
(optsHeaderRight opts defHeaderRight)
6869
<> argsContent args
69-
<> newFlex
70+
<> Flex.flexLeftRight
7071
footer_
7172
id
7273
(optsFooterLeft opts mempty)
@@ -111,37 +112,6 @@ dialog opts args =
111112
]
112113
]
113114

114-
newFlex ::
115-
([Attribute action] -> [View action] -> View action) ->
116-
([Attribute action] -> [Attribute action]) ->
117-
[View action] ->
118-
[View action] ->
119-
[View action]
120-
newFlex newTag newAttr lhs rhs =
121-
if null lhs && null rhs
122-
then mempty
123-
else
124-
singleton
125-
. newTag
126-
( newAttr
127-
[ style_
128-
[ ("display", "flex"),
129-
("flex-wrap", "wrap"),
130-
("flex-direction", "row"),
131-
("justify-content", "space-between")
132-
]
133-
]
134-
)
135-
$ lhs
136-
<> [ div_
137-
[ style_
138-
[ ("flex-grow", "1")
139-
]
140-
]
141-
mempty
142-
]
143-
<> rhs
144-
145115
closeDialogAction :: Opts model action -> Args model action -> action
146116
closeDialogAction opts args =
147117
argsAction args

0 commit comments

Comments
 (0)