Fix checkbox (#175)

* Update src/Nri/Ui/Checkbox/V3.elm

* port to 0.18 as well
This commit is contained in:
Tereza Sokol 2018-11-16 01:30:40 -05:00 committed by Luke Westby
parent 82873bef78
commit 3d80d512c6
2 changed files with 14 additions and 2 deletions

View File

@ -248,6 +248,12 @@ viewCheckbox :
} }
-> Html.Html msg -> Html.Html msg
viewCheckbox model config = viewCheckbox model config =
let
toggledValue =
selectedToMaybe model.selected
|> Maybe.withDefault False
|> not
in
Html.Styled.span Html.Styled.span
[ css [ css
[ display block [ display block
@ -266,7 +272,7 @@ viewCheckbox model config =
[ Html.checkbox model.identifier [ Html.checkbox model.identifier
(selectedToMaybe model.selected) (selectedToMaybe model.selected)
[ Widget.label model.label [ Widget.label model.label
, Events.onCheck model.setterMsg , Events.onClick (model.setterMsg toggledValue)
, Attributes.id model.identifier , Attributes.id model.identifier
, Attributes.disabled model.disabled , Attributes.disabled model.disabled
] ]

View File

@ -248,6 +248,12 @@ viewCheckbox :
} }
-> Html.Html msg -> Html.Html msg
viewCheckbox model config = viewCheckbox model config =
let
toggledValue =
selectedToMaybe model.selected
|> Maybe.withDefault False
|> not
in
Html.Styled.span Html.Styled.span
[ css [ css
[ display block [ display block
@ -265,7 +271,7 @@ viewCheckbox model config =
[ Html.checkbox model.identifier [ Html.checkbox model.identifier
(selectedToMaybe model.selected) (selectedToMaybe model.selected)
[ Widget.label model.label [ Widget.label model.label
, Events.onCheck model.setterMsg , Events.onClick (model.setterMsg toggledValue)
, Attributes.id model.identifier , Attributes.id model.identifier
, Attributes.disabled model.disabled , Attributes.disabled model.disabled
] ]