aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Form/Input.hs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-10-11 23:30:56 +0200
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-10-11 23:30:56 +0200
commit80a6150610182eefa0deb1f0932d3b780456ca09 (patch)
tree4471a8ffecfc527d6b9c2a5c48e445e7a4d6a74f /frontend/app/Form/Input.hs
parent2e0cf98254976e443ea7f693961fc105ed6cf563 (diff)
use backend REST library for frontend
Diffstat (limited to 'frontend/app/Form/Input.hs')
-rw-r--r--frontend/app/Form/Input.hs19
1 files changed, 9 insertions, 10 deletions
diff --git a/frontend/app/Form/Input.hs b/frontend/app/Form/Input.hs
index e43651c..99fd821 100644
--- a/frontend/app/Form/Input.hs
+++ b/frontend/app/Form/Input.hs
@@ -3,30 +3,29 @@ module Form.Input
)
where
-import Data.Text qualified as T
import Form.Internal
import Miso
-import Miso.String (fromMisoString, toMisoString)
+import Miso.String (MisoString, null, strip)
-input :: String -> Form T.Text T.Text
+input :: MisoString -> Form MisoString MisoString
input label =
- let parse :: T.Text -> Either String T.Text
+ let parse :: MisoString -> Either MisoString MisoString
parse i =
- let i' = T.strip i
- in if T.null i' then Left "required" else Right i'
+ let i' = strip i
+ in if Miso.String.null i' then Left "required" else Right i'
in Form
{ view = \i ->
[ div_ [] $
[ label_ [] $
- [ text (toMisoString label),
+ [ text label,
div_ [] $
[ input_
[ type_ "text",
- value_ (toMisoString i),
- onInput fromMisoString
+ value_ i,
+ onInput id
],
div_ [] $
- [either (text . toMisoString) (\_ -> text "") (parse i)]
+ [either text (\_ -> text "") (parse i)]
]
]
]