aboutsummaryrefslogtreecommitdiffstats
path: root/frontend/app/Form/Input.hs
blob: 4b1eac83597ae994dbf79d4085968dc688a0e049 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
module Form.Input
  ( string,
  )
where

import Data.Text qualified as T
import Form.Internal
import Miso
import Miso.String (fromMisoString, toMisoString)

string :: String -> Form T.Text T.Text
string label =
  Form
    { view = \i ->
        [ div_ [] $
            [ label_ [] $
                [ text (toMisoString label),
                  input_
                    [ type_ "text",
                      value_ (toMisoString i),
                      onInput fromMisoString
                    ]
                ]
            ]
        ],
      fill = \i -> Right i
    }