aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Main.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-04 12:32:59 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-06-04 12:34:16 +0200
commit03b019ca96ceb83113a5ea34f4b48b039c56f02d (patch)
tree6962da877db855ba9b40d91fc50bd7ac8a7a7930 /frontend/app/Main.hs
parent9d3c32956baab4dc4e1fd114e586b48d850a14c9 (diff)
add css
Diffstat (limited to 'frontend/app/Main.hs')
-rw-r--r--frontend/app/Main.hs102
1 files changed, 98 insertions, 4 deletions
diff --git a/frontend/app/Main.hs b/frontend/app/Main.hs
index 356aa6e..9151705 100644
--- a/frontend/app/Main.hs
+++ b/frontend/app/Main.hs
@@ -26,6 +26,7 @@ import Form qualified as F
import GHC.Generics (Generic)
import Miso
import Miso.String (toMisoString)
+import NeatInterpolation qualified as Q
data Model = Model
{ schema :: Maybe (Either String Schema),
@@ -162,15 +163,108 @@ viewModel :: Model -> View Action
viewModel model =
let input = fromMaybe (A.Object AM.empty) model.input
in div_ [] $
- [ maybe (text "..") (either err viewSchema) model.schema,
- maybe (text "..") (either err viewPosts) model.posts,
- maybe (text "..") (either err (viewForm input)) model.schema,
- viewInput input
+ [ viewCss,
+ viewHeader,
+ nav_ [] [viewCollections],
+ main_ [] $
+ [ maybe (text "..") (either err viewSchema) model.schema,
+ maybe (text "..") (either err viewPosts) model.posts,
+ maybe (text "..") (either err (viewForm input)) model.schema,
+ viewInput input
+ ]
]
+viewCss :: View Action
+viewCss =
+ node
+ HTML
+ "style"
+ Nothing
+ [type_ "text/css"]
+ [ text
+ ( toMisoString
+ [Q.text|
+/* normalize */
+* {
+ box-sizing: border-box; }
+body {
+ margin: 0;
+ min-height: 100vh; }
+
+/* typography */
+html {
+ font: Iosevka; }
+
+/* layout */
+body > div {
+ display: flex;
+ flex-flow: row nowrap;
+ min-height: 100vh;
+ padding-top: 64px;
+ align-items: stretch; }
+header {
+ position: fixed;
+ top: 0; left: 0;
+ width: 100%;
+ height: 64px; }
+nav, main {
+ min-height: 100%; }
+nav {
+ flex: 0 0 200px; }
+main {
+ flex: 1 1 auto; }
+
+/* borders */
+header {
+ border-bottom: 1px solid gray; }
+nav {
+ border-right: 1px solid gray; }
+
+/* padding */
+nav, header, main {
+ padding: 16px; }
+
+/* scrolling */
+body > div {
+ overflow: visible; }
+header {
+ overflow: visible; }
+nav, main {
+ overflow: auto; }
+
+/* header */
+header {
+ display: flex;
+ align-items: center; }
+header section {
+ margin-left: auto; }
+header section:first-child {
+ margin-left: 0; }
+|]
+ )
+ ]
+
err :: String -> View Action
err = text . toMisoString . ("err! " <>)
+viewHeader :: View Action
+viewHeader =
+ header_ [] $
+ [ section_ [] [h1_ [] [text "acms"]],
+ section_ [] [viewBranch]
+ ]
+
+viewBranch :: View Action
+viewBranch =
+ select_ [] [option_ [] [text "main"]]
+
+viewCollections :: View Action
+viewCollections =
+ section_ [] $
+ [ span_ [] [text "collections"],
+ ol_ [] [li_ [] [a_ [href_ "#"] [text "posts"]]]
+ ]
+
viewSchema :: Schema -> View Action
viewSchema schema =
case schema.type_ of