Safe Haskell | None |
---|---|
Language | GHC2021 |
Synopsis
- newtype View context a = View {}
- data ViewState = ViewState {}
- runView :: context -> View context () -> ViewState
- context :: View context context
- addContext :: context -> View context () -> View c ()
- viewModContents :: ([Content] -> [Content]) -> View context ()
- viewModCss :: (CSS -> CSS) -> View context ()
- viewAddClasses :: [Class] -> View c ()
- viewAddContent :: Content -> View c ()
- viewInsertContents :: [Content] -> View c ()
- tag :: Text -> Mod -> View c () -> View c ()
- tag' :: (Attributes -> [Content] -> Element) -> Mod -> View c () -> View c ()
- att :: Name -> AttValue -> Mod
Views
newtype View context a Source #
Views are HTML fragments that carry all CSS
used by any child element.
view :: View c () view = col (pad 10 . gap 10) $ do el bold "Hello" el_ "World"
They can also have a context which can be used to create type-safe or context-aware elements. See table
for an example
addContext :: context -> View context () -> View c () Source #
viewAddClasses :: [Class] -> View c () Source #
viewAddContent :: Content -> View c () Source #
viewInsertContents :: [Content] -> View c () Source #
Inserts contents into the first child element
Creating new Elements
tag :: Text -> Mod -> View c () -> View c () Source #
Create a new element constructor with the given tag name
aside :: Mod -> View c () -> View c () aside = tag "aside"