Minimal reusable functions to enrich common use of elm/html
elm install lettenj61/elm-reusable-htmlThis package come with two part:
Tag msg type, an alias for List (Attribute msg) -> List (Html msg) -> Html msg.Tags.Explore the document and tests for use cases.
import Html exposing (..)
import Html.Attributes exposing (..)
import Reusable exposing (Tag)
-- You'll have an `a` anchor wrapped in `li`
bcAnchor : Tag msg
bcAnchor =
Reusable.wrap ( li, [] ) a
-- This `ul` always have default `class`
bcList : Tag msg
bcList =
ul |> Reusable.extend [ class "breadcrumb" ]
-- And put things together
breadcrumb : List ( String, String ) -> Html msg
breadcrumb props =
bcList [] <|
List.map
(\( path, lbl ) ->
bcAnchor [ href path ] [ text lbl ]
)
propsThis library is licensed under either of: