mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-27 03:14:25 +03:00
Use attribute helpers to build the link
This commit is contained in:
parent
4ece9ee8ea
commit
0424d15cd3
@ -48,13 +48,11 @@ button name attributes icon =
|
||||
|
||||
|
||||
{-| -}
|
||||
link : String -> Svg -> Html msg
|
||||
link url svg =
|
||||
Html.a
|
||||
[ Attributes.href url
|
||||
]
|
||||
[ Svg.toHtml svg
|
||||
]
|
||||
link : String -> List (Attribute msg) -> Svg -> Html msg
|
||||
link name attributes icon =
|
||||
(set (\a -> { a | label = name }) :: attributes)
|
||||
|> List.foldl (\(Attribute attribute) b -> attribute b) (build icon)
|
||||
|> renderLink
|
||||
|
||||
|
||||
|
||||
|
@ -51,11 +51,11 @@ example unnamedMessages state =
|
||||
[ ClickableSvg.onClick (parentMessages.showItWorked "You clicked the button!") ]
|
||||
]
|
||||
, Html.div [ Attributes.css [ Css.displayFlex ] ]
|
||||
[ viewCode "ClickableSvg.link \"#some_link\""
|
||||
[ viewCode "ClickableSvg.link \"Back\" \n\t[ ClickableSvg.href \"#some_link\" ]"
|
||||
, UiIcon.arrowLeft
|
||||
|> Svg.withWidth (Css.px 100)
|
||||
|> Svg.withHeight (Css.px 100)
|
||||
|> ClickableSvg.link "#some_link"
|
||||
|> ClickableSvg.link "Back" [ ClickableSvg.href "#some_link" ]
|
||||
]
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user