From 57b892ef54c1747953b25395bfab78835e62d2a7 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 17 Dec 2024 23:53:00 +0100 Subject: style menu --- frontend/app/Main.hs | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 2 deletions(-) (limited to 'frontend/app/Main.hs') diff --git a/frontend/app/Main.hs b/frontend/app/Main.hs index e4729b4..eb05983 100644 --- a/frontend/app/Main.hs +++ b/frontend/app/Main.hs @@ -7,6 +7,7 @@ import Language.Javascript.JSaddle.Warp as JSaddle #endif import ACMS.API.REST as API.REST +import Control.Monad (join) import Control.Monad.Catch import Control.Monad.Trans import Data.Bifunctor @@ -20,6 +21,7 @@ import NeatInterpolation qualified as Q import Page (Page, initialPage, updatePage, viewPage) import Page qualified as Page import Route (parseURI) +import Route qualified import Version data Model @@ -189,7 +191,7 @@ header { nav, main { min-height: 100%; } nav { - flex: 0 0 200px; } + flex: 0 0 260px; } main { flex: 1 1 auto; } @@ -236,6 +238,52 @@ table { th, td { border-top: 1px solid gray; border-bottom: 1px solid gray; } + +/* menu */ +nav { + padding: 16px 0 0; } + +nav ol { + list-style-type: none; + line-height: 32px; + padding: 0; + margin: 0; } + +nav { + display: flex; + flex-flow: column nowrap; + height: calc(100vh - 64px); } + +nav section { + display: flex; + flex-flow: column nowrap; } + +nav section > span { + line-height: 32px; + padding-left: 8px; } + +nav section > span:not(:first-child) { + margin-top: 24px; } + +nav li { + white-space: pre; + overflow: hidden; + text-overflow: ellipsis; } + +nav li { + display: flex; } + +nav li a { + flex: 0 0 100%; + padding: 4px 8px 4px; + color: black; + text-decoration: none; } + +nav li a.active { + background-color: lightgray; } + +nav li a:hover, nav li a:active { + background-color: whitesmoke; } |] ) ] @@ -270,7 +318,18 @@ viewCollections s = [ li_ [] [ a_ - [href_ (toMisoString ("#collection/" <> collection))] + ( concat + [ [href_ (toMisoString ("#collection/" <> collection))], + if ( fmap Page.route + . join + . fmap (either (\_ -> Nothing) Just) + $ s.page + ) + == Just (Route.ListCollection collection) + then [class_ "active"] + else [] + ] + ) [text (toMisoString collection)] ] | collection <- s.collections -- cgit v1.2.3