noredink-ui/styleguide-app/ViewHelpers.elm

20 lines
518 B
Elm
Raw Normal View History

2021-10-28 02:40:03 +03:00
module ViewHelpers exposing (viewExamples)
import Css
import Html.Styled as Html exposing (Html)
2022-03-15 21:06:13 +03:00
import Html.Styled.Attributes exposing (css)
2021-10-28 02:40:03 +03:00
viewExamples : List ( String, Html msg ) -> Html msg
viewExamples examples =
let
viewExample ( name, view ) =
Html.tr []
[ Html.th [] [ Html.text name ]
, Html.td [] [ view ]
]
in
Html.table [ css [ Css.width (Css.pct 100) ] ]
[ Html.tbody [] (List.map viewExample examples)
]