diff options
author | Joris | 2019-10-13 22:38:35 +0200 |
---|---|---|
committer | Joris | 2019-10-13 22:38:35 +0200 |
commit | 04c59f08f100ba6a0658d1f2b357f7d8b1e14218 (patch) | |
tree | 0cf226423411428e46b2fa6a66c0da00d77483be /client/src/Component | |
parent | 6dfc1c166db387a60630eff980e330518601df5b (diff) |
Show income table
Diffstat (limited to 'client/src/Component')
-rw-r--r-- | client/src/Component/Table.hs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/client/src/Component/Table.hs b/client/src/Component/Table.hs new file mode 100644 index 0000000..a77a18d --- /dev/null +++ b/client/src/Component/Table.hs @@ -0,0 +1,38 @@ +module Component.Table + ( table + , TableIn(..) + , TableOut(..) + ) where + +import Data.Text (Text) +import Reflex.Dom (Dynamic, MonadWidget) +import qualified Reflex.Dom as R + +data TableIn h r t = TableIn + { _tableIn_headerLabel :: h -> Text + , _tableIn_rows :: Dynamic t [r] + , _tableIn_cell :: h -> r -> Text + } + +data TableOut = TableOut + {} + +table :: forall t m h r. (MonadWidget t m, Bounded h, Enum h) => TableIn h r t -> m (TableOut) +table tableIn = do + R.divClass "table" $ do + + R.divClass "lines" $ do + R.divClass "header" $ do + flip mapM_ [minBound..] $ \header -> + R.divClass "cell" . R.text $ + _tableIn_headerLabel tableIn header + + R.simpleList (_tableIn_rows tableIn) $ \r -> + R.divClass "row" $ + flip mapM_ [minBound..] $ \h -> + R.divClass "cell name" $ + R.dynText $ + R.ffor r (_tableIn_cell tableIn h) + + return $ TableOut + {} |