From d72aaca7674906eaa0fc8dcb21203dde724581c2 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Wed, 20 Jun 2018 12:48:49 -0700 Subject: [PATCH] Pass through the checkbox icon in --- src/Nri/Ui/Checkbox/V3.elm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/src/Nri/Ui/Checkbox/V3.elm b/src/Nri/Ui/Checkbox/V3.elm index 6c84761e..220238f6 100644 --- a/src/Nri/Ui/Checkbox/V3.elm +++ b/src/Nri/Ui/Checkbox/V3.elm @@ -105,20 +105,31 @@ buildCheckbox assets modifierClasses model labelContent = case model.theme of Square -> { containerClasses = toClassList (modifierClasses ++ [ "SquareClass" ]) - , labelStyles = squareLabelStyles assets model + , labelStyles = + squareLabelStyles model <| + case model.selected of + Selected -> + assets.checkboxChecked_svg + + NotSelected -> + assets.checkboxUnchecked_svg + + PartiallySelected -> + assets.checkboxCheckedPartially_svg , labelClasses = labelClass model.selected , labelContent = labelContent } LockOnInside -> { containerClasses = toClassList (modifierClasses ++ [ "LockOnInsideClass" ]) - , labelStyles = lockLabelStyles assets.checkboxLockOnInside_svg model + , labelStyles = lockLabelStyles model assets.checkboxLockOnInside_svg , labelClasses = labelClass model.selected , labelContent = labelContent } -squareLabelStyles assets model = +squareLabelStyles : { b | disabled : Bool } -> Asset -> Html.Styled.Attribute msg +squareLabelStyles model image = let baseStyles = [ -- Postioning @@ -137,15 +148,7 @@ squareLabelStyles assets model = -- Icon , backgroundRepeat noRepeat , property "background-position" "left center" - , case model.selected of - Selected -> - backgroundImage assets.checkboxChecked_svg - - NotSelected -> - backgroundImage assets.checkboxUnchecked_svg - - PartiallySelected -> - backgroundImage assets.checkboxCheckedPartially_svg + , backgroundImage image ] in css @@ -156,7 +159,8 @@ squareLabelStyles assets model = ) -lockLabelStyles image model = +lockLabelStyles : { b | disabled : Bool } -> Asset -> Html.Styled.Attribute msg +lockLabelStyles model image = let baseStyles = [ -- Positioning