Files
acms/frontend/app/Form/Input.hs

28 lines
576 B
Haskell
Raw Normal View History

2024-06-04 09:28:10 +02:00
module Form.Input
2024-06-06 22:42:44 +02:00
( input,
2024-06-04 09:28:10 +02:00
)
where
import Data.Text qualified as T
import Form.Internal
import Miso
2024-06-04 09:59:10 +02:00
import Miso.String (fromMisoString, toMisoString)
2024-06-04 09:28:10 +02:00
2024-06-06 22:42:44 +02:00
input :: String -> Form T.Text T.Text
input label =
2024-06-04 09:28:10 +02:00
Form
{ view = \i ->
[ div_ [] $
[ label_ [] $
[ text (toMisoString label),
input_
[ type_ "text",
2024-06-04 09:59:10 +02:00
value_ (toMisoString i),
onInput fromMisoString
2024-06-04 09:28:10 +02:00
]
]
]
],
fill = \i -> Right i
}