diff options
author | 2024-12-20 21:18:31 +0100 | |
---|---|---|
committer | 2025-02-19 19:02:13 +0100 | |
commit | eacb4c9653df0112e6921f8fa35922284773fec5 (patch) | |
tree | 287de1f78b089621200df9901139d9abedf3fba6 /frontend | |
parent | 1af7db8185394e9fd743e9e127c62a1837773ab4 (diff) |
style form
Diffstat (limited to 'frontend')
-rw-r--r-- | frontend/app/Form/Input.hs | 8 | ||||
-rw-r--r-- | frontend/app/Main.hs | 33 |
2 files changed, 38 insertions, 3 deletions
diff --git a/frontend/app/Form/Input.hs b/frontend/app/Form/Input.hs index 3539e96..0b4f1ca 100644 --- a/frontend/app/Form/Input.hs +++ b/frontend/app/Form/Input.hs @@ -120,7 +120,9 @@ inputNumber label = let parse :: MisoString -> Either MisoString Double parse i = let i' = strip i - in if Miso.String.null i' then Left "required" else Right (read (fromMisoString i')) + in if Miso.String.null i' + then Left "required" + else Right (read (fromMisoString i')) in Form { view = \i -> [ div_ [] $ @@ -149,7 +151,7 @@ inputText label = in if Miso.String.null i' then Left "required" else Right i' in Form { view = \i -> - [ div_ [] $ + [ div_ [class_ "input text"] $ [ label_ [] $ [ text label, div_ [] $ @@ -158,7 +160,7 @@ inputText label = value_ i, onInput id ], - div_ [] $ + div_ [ class_ "error-helper" ] $ [either text (\_ -> text "") (parse i)] ] ] diff --git a/frontend/app/Main.hs b/frontend/app/Main.hs index d851cca..bf8ada3 100644 --- a/frontend/app/Main.hs +++ b/frontend/app/Main.hs @@ -295,6 +295,39 @@ table td { overflow: hidden; text-overflow: ellipsis; max-width: 480px; } + +/* form */ +.input label { + display: block; + padding-left: 6px; } + +.input .error-helper { + display: block; + padding-left: 6px; } + +.input label > div { + margin-left: -6px; + margin-right: -6px; } + +.input input { + font-size: 1rem; + margin-top: 4px; + margin-bottom: 4px; } + +.input input[type=text] { + padding: 2px 6px; } + +form { + margin: -12px 0; } + +.error-helper { + color: red; + line-height: 1rem; + height: 1rem; } + +.input { + margin: 12px 0; } + |] ) ] |