mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-30 06:07:41 +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 : String -> List (Attribute msg) -> Svg -> Html msg
|
||||||
link url svg =
|
link name attributes icon =
|
||||||
Html.a
|
(set (\a -> { a | label = name }) :: attributes)
|
||||||
[ Attributes.href url
|
|> List.foldl (\(Attribute attribute) b -> attribute b) (build icon)
|
||||||
]
|
|> renderLink
|
||||||
[ Svg.toHtml svg
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ example unnamedMessages state =
|
|||||||
[ ClickableSvg.onClick (parentMessages.showItWorked "You clicked the button!") ]
|
[ ClickableSvg.onClick (parentMessages.showItWorked "You clicked the button!") ]
|
||||||
]
|
]
|
||||||
, Html.div [ Attributes.css [ Css.displayFlex ] ]
|
, Html.div [ Attributes.css [ Css.displayFlex ] ]
|
||||||
[ viewCode "ClickableSvg.link \"#some_link\""
|
[ viewCode "ClickableSvg.link \"Back\" \n\t[ ClickableSvg.href \"#some_link\" ]"
|
||||||
, UiIcon.arrowLeft
|
, UiIcon.arrowLeft
|
||||||
|> Svg.withWidth (Css.px 100)
|
|> Svg.withWidth (Css.px 100)
|
||||||
|> Svg.withHeight (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