Skip to content

Commit 8131f3b

Browse files
committed
icons wip
1 parent 55a97a3 commit 8131f3b

24 files changed

+9228
-29
lines changed

ghcjs/delivery-calculator/flake.nix

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,12 @@
4747
${app-release-wasm}/bin/app-release-wasm
4848
out="./dist/latest"
4949
rm -rf "$out"
50-
mkdir -p "$out/static"
50+
mkdir -p "$out/static/css"
51+
cp -R ./static/webfonts $out/webfonts
5152
cp ./static/*.png $out/static/
5253
cp ./static/*.woff2 $out/static/
5354
cp ./static/*.webmanifest $out/
5455
cp ./static/*.ico $out/
55-
# cp ./static/wasm.js $out/
5656
cp ./dist/wasm/* $out/
5757
5858
echo "# [Back](index.html)" > "$out/index-link.md"
@@ -87,8 +87,9 @@
8787
${pkgs.clean-css-cli}/bin/cleancss \
8888
-O2 \
8989
--source-map \
90-
-o $out/static/all.css \
91-
./static/app.css
90+
-o $out/static/css/all.css \
91+
./static/css/fontawesome.min.css \
92+
./static/css/app.css
9293
9394
${pkgs.nodejs}/bin/npm i --prefer-offline
9495
${pkgs.nodejs}/bin/npm run build

ghcjs/delivery-calculator/src/App/Types.hs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module App.Types
1919
setScreenPure,
2020
setScreenAction,
2121
pushActionQueue,
22+
icon,
2223
vsn,
2324
usd,
2425
btc,
@@ -46,6 +47,7 @@ import Functora.Miso.Types as X hiding
4647
)
4748
import qualified Functora.Miso.Types as FM
4849
import qualified Functora.Miso.Widgets.Field as Field
50+
import qualified Functora.Miso.Widgets.Icon as Icon
4951
import Functora.Money hiding (Currency, Money, Text)
5052
import qualified Functora.Prelude as Prelude
5153
import qualified Functora.Rates as Rates
@@ -319,6 +321,9 @@ pushActionQueue st =
319321
. atomically
320322
. writeTChan (st ^. #modelProducerQueue)
321323

324+
icon :: Icon.Fa -> View Action
325+
icon = Icon.icon
326+
322327
vsn :: Unicode
323328
vsn =
324329
intercalate "."

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import qualified Functora.Miso.Widgets.Currency as Currency
1414
import qualified Functora.Miso.Widgets.Dialog as Dialog
1515
import qualified Functora.Miso.Widgets.Field as Field
1616
import qualified Functora.Miso.Widgets.Grid as Grid
17+
import qualified Functora.Miso.Widgets.Icon as Icon
1718
import qualified Functora.Miso.Widgets.Select as Select
1819
import qualified Functora.Money as Money
1920
import qualified Text.URI as URI
@@ -23,8 +24,10 @@ menu st =
2324
[ menu_
2425
[ class_ "no-print",
2526
style_
26-
[ ("flex-direction", "row"),
27-
("flex-wrap", "wrap")
27+
[ ("display", "flex"),
28+
("flex-wrap", "wrap"),
29+
("flex-direction", "row"),
30+
("justify-content", "space-between")
2831
]
2932
]
3033
[ li_
@@ -42,7 +45,7 @@ menu st =
4245
pure id
4346
)
4447
]
45-
[ text "menu"
48+
[ icon Icon.menu
4649
],
4750
li_
4851
[ role_ "button",
@@ -52,6 +55,10 @@ menu st =
5255
]
5356
[ text "Delivery Calculator"
5457
],
58+
div_
59+
[ style_ [("flex-grow", "1")]
60+
]
61+
mempty,
5562
li_
5663
[ role_ "button",
5764
onClick
@@ -67,7 +74,7 @@ menu st =
6774
pure id
6875
)
6976
]
70-
[ text "favorite"
77+
[ icon Icon.fav
7178
],
7279
li_
7380
[ role_ "button",
@@ -79,7 +86,7 @@ menu st =
7986
Jsm.printCurrentPage "delivery-calculator"
8087
pure id
8188
]
82-
[ text "print"
89+
[ icon Icon.print
8390
],
8491
li_
8592
[ role_ "button",
@@ -94,7 +101,7 @@ menu st =
94101
Xlsx.newXlsx
95102
pure id
96103
]
97-
[ text "download"
104+
[ icon Icon.download
98105
],
99106
li_
100107
[ role_ "button",
@@ -106,7 +113,7 @@ menu st =
106113
. either impureThrow URI.renderStr
107114
$ stUri st
108115
]
109-
[ text "share"
116+
[ icon Icon.share
110117
]
111118
]
112119
]

ghcjs/delivery-calculator/src/Main.hs

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import App.Types
1919
import App.Widgets.Main
2020
import App.Widgets.Templates
2121
import qualified Data.Generics as Syb
22-
import qualified Data.Map as Map
2322
import qualified Functora.Miso.Jsm as Jsm
2423
import Functora.Miso.Prelude
2524
import qualified Functora.Money as Money
@@ -53,7 +52,7 @@ main =
5352
update = updateModel,
5453
Miso.view = viewModel,
5554
subs = mempty,
56-
events = extendedEvents,
55+
events = mempty,
5756
initialAction = InitUpdate mSt,
5857
mountPoint = Nothing,
5958
logLevel = Off
@@ -245,25 +244,16 @@ viewModel st =
245244
],
246245
link_
247246
[ rel_ "stylesheet",
248-
href_ "static/app.css"
247+
href_ "static/css/fontawesome.min.css"
248+
],
249+
link_
250+
[ rel_ "stylesheet",
251+
href_ "static/css/app.css"
249252
]
250253
]
251254
$ mainWidget st
252255
#endif
253256

254-
extendedEvents :: Map Unicode Bool
255-
extendedEvents =
256-
defaultEvents
257-
& Map.insert "MDCDialog:close" True
258-
& Map.insert "MDCDrawer:close" True
259-
& Map.insert "MDCList:action" True
260-
& Map.insert "MDCSnackbar:closed" True
261-
& Map.insert "MDCTab:interacted" True
262-
& Map.insert "MDCSlider:input" True
263-
& Map.insert "MDCMenuSurface:close" True
264-
& Map.insert "MDCChip:interaction" True
265-
& Map.insert "MDCIconButtonToggle:change" True
266-
267257
--
268258
-- NOTE : The "correct" way is to use "controlled input" with
269259
-- TextField.setValue but it does cause race conditions
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
html {
2+
width: 100vw;
3+
min-height: 100vh;
4+
}
5+
6+
html, main {
7+
margin: 0;
8+
padding: 0;
9+
}
10+
11+
footer {
12+
padding-bottom: 18px;
13+
}
14+
15+
.main-widget {
16+
margin: 0;
17+
padding: 0;
18+
width: 100%;
19+
min-height: 100vh;
20+
display: flex;
21+
flex-direction: column;
22+
justify-content: space-between;
23+
/* overflow-x: hidden; */
24+
}
25+
26+
.main-widget-middle {
27+
max-width: 550px;
28+
}
29+
30+
textarea {
31+
resize: vertical;
32+
pointer-events: auto;
33+
min-height: 72px;
34+
}
35+
36+
@media print {
37+
body {
38+
color-adjust: exact !important;
39+
print-color-adjust: exact !important;
40+
-webkit-print-color-adjust: exact;
41+
}
42+
.no-print {
43+
display: none !important;
44+
}
45+
@page {
46+
size: A4;
47+
margin: 15mm;
48+
background-color: #fff;
49+
}
50+
}
51+
52+
.lds-dual-ring {
53+
display: inline-block;
54+
width: 80px;
55+
height: 80px;
56+
}
57+
58+
.lds-dual-ring:after {
59+
content: " ";
60+
display: block;
61+
width: 64px;
62+
height: 64px;
63+
margin: 8px;
64+
border-radius: 50%;
65+
border: 6px solid #ffffff;
66+
border-color: #ffffff transparent #ffffff transparent;
67+
animation: lds-dual-ring 1.2s linear infinite;
68+
}
69+
70+
@keyframes lds-dual-ring {
71+
0% {
72+
transform: rotate(0deg);
73+
}
74+
100% {
75+
transform: rotate(360deg);
76+
}
77+
}

ghcjs/delivery-calculator/static/css/fontawesome.min.css

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ghcjs/delivery-calculator/static/wasm.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
<link rel="preconnect" href="https://cdn.jsdelivr.net" />
99
<link
1010
rel="preload"
11-
href="static/all.css"
11+
href="static/css/all.css"
1212
as="style"
1313
onload="this.onload=null;this.rel='stylesheet'"
1414
/>
1515
<noscript>
16-
<link rel="stylesheet" href="static/all.css" />
16+
<link rel="stylesheet" href="static/css/all.css" />
1717
</noscript>
1818
</head>
1919
<body></body>
130 KB
Binary file not shown.

0 commit comments

Comments
 (0)