aboutsummaryrefslogtreecommitdiff
path: root/client/src/Component/Tag.hs
blob: f75b8d349602ec2a088d21f12276294a1d765683 (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 Component.Tag
  ( In(..)
  , view
  ) where

import qualified Data.Map   as M
import           Data.Text  (Text)
import qualified Data.Text  as T
import           Reflex.Dom (MonadWidget)
import qualified Reflex.Dom as R

data In = In
  { _in_text  :: Text
  , _in_color :: Text
  }

view :: forall t m a. MonadWidget t m => In -> m ()
view input =
  R.elAttr "span" attrs $
    R.text $ _in_text input

  where
    attrs =
      M.fromList
        [ ("class", "tag")
        , ("style", T.concat [ "background-color: ", _in_color input ])
        ]