Make the label explicit

This commit is contained in:
Tessa Kelly 2022-03-04 10:47:06 -08:00
parent ce8d858805
commit 3387c6fc1b

View File

@ -57,11 +57,11 @@ example =
, view = , view =
\state -> \state ->
let let
( icon, attributes ) = { label, icon, attributes } =
applySettings state.settings Control.currentValue state.settings
in in
[ Html.fromUnstyled (Control.view SetControls state.settings) [ Html.fromUnstyled (Control.view SetControls state.settings)
, viewExampleTable icon attributes , viewExampleTable label icon attributes
, viewExample , viewExample
""" """
Tooltip.view Tooltip.view
@ -104,8 +104,8 @@ Tooltip.view
} }
viewExampleTable : Svg -> List (ClickableSvg.Attribute Msg) -> Html Msg viewExampleTable : String -> Svg -> List (ClickableSvg.Attribute Msg) -> Html Msg
viewExampleTable icon attributes = viewExampleTable label icon attributes =
let let
viewExampleRow index ( themeName, theme ) = viewExampleRow index ( themeName, theme ) =
Html.tr [] Html.tr []
@ -129,14 +129,14 @@ viewExampleTable icon attributes =
] ]
buttonExample attributes_ = buttonExample attributes_ =
ClickableSvg.button "Button example" ClickableSvg.button label
icon icon
(ClickableSvg.onClick (ShowItWorked "You clicked the back button!") (ClickableSvg.onClick (ShowItWorked "You clicked the back button!")
:: attributes_ :: attributes_
) )
linkExample attributes_ = linkExample attributes_ =
ClickableSvg.link "Link example" ClickableSvg.link label
icon icon
(ClickableSvg.linkSpa "some_link" :: attributes_) (ClickableSvg.linkSpa "some_link" :: attributes_)
in in
@ -234,23 +234,16 @@ update msg state =
type alias Settings msg = type alias Settings msg =
{ icon : Svg { label : String
, icon : Svg
, attributes : List (ClickableSvg.Attribute msg) , attributes : List (ClickableSvg.Attribute msg)
} }
applySettings : Control (Settings msg) -> ( Svg, List (ClickableSvg.Attribute msg) )
applySettings settings =
let
{ icon, attributes } =
Control.currentValue settings
in
( icon, attributes )
initSettings : Control (Settings msg) initSettings : Control (Settings msg)
initSettings = initSettings =
Control.record Settings Control.record Settings
|> Control.field "label" (Control.string "Back")
|> Control.field "icon" |> Control.field "icon"
(Control.choice (Control.choice
[ ( "arrowLeft", Control.value UiIcon.arrowLeft ) [ ( "arrowLeft", Control.value UiIcon.arrowLeft )