From 83575dd29a1a2a0731c45266c778767f70c61639 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Tue, 19 Jun 2018 17:34:32 -0700 Subject: [PATCH] :skull: kill unecessary redirection --- src/Nri/Ui/Checkbox/V3.elm | 57 ++++++++------------------------------ 1 file changed, 11 insertions(+), 46 deletions(-) diff --git a/src/Nri/Ui/Checkbox/V3.elm b/src/Nri/Ui/Checkbox/V3.elm index 4c53b9f5..ddbee918 100644 --- a/src/Nri/Ui/Checkbox/V3.elm +++ b/src/Nri/Ui/Checkbox/V3.elm @@ -199,13 +199,13 @@ buildCheckbox assets modifierClasses model labelContent = , display inlineBlock , case model.selected of Selected -> - backgroundImageDeprecated assets CheckboxChecked + backgroundImage (assetPathUrl assets.checkboxChecked_svg) NotSelected -> - backgroundImageDeprecated assets CheckboxUnchecked + backgroundImage (assetPathUrl assets.checkboxUnchecked_svg) PartiallySelected -> - backgroundImageDeprecated assets CheckboxCheckedPartially + backgroundImage (assetPathUrl assets.checkboxCheckedPartially_svg) , Css.batch <| case colorTheme of Gray -> @@ -222,7 +222,7 @@ buildCheckbox assets modifierClasses model labelContent = { containerClasses = toClassList (modifierClasses ++ [ "LockedClass" ]) , labelStyles = css - [ backgroundImageDeprecated assets PremiumLocked + [ backgroundImage (assetPathUrl assets.iconPremiumLocked_png) , backgroundRepeat noRepeat , color Colors.gray20 , display inlineBlock @@ -243,7 +243,7 @@ buildCheckbox assets modifierClasses model labelContent = { containerClasses = toClassList (modifierClasses ++ [ "LockOnInsideClass" ]) , labelStyles = css - [ backgroundImageDeprecated assets CheckboxLockOnInside + [ backgroundImage (assetPathUrl assets.checkboxLockOnInside_svg) , backgroundRepeat noRepeat , backgroundSize (px 24) , color Colors.gray20 @@ -392,7 +392,7 @@ premiumLabelStyles image model = , width (px 26) , height (px 24) , marginLeft (px 8) - , backgroundImage ((url << Nri.Ui.AssetPath.Css.url) image) + , backgroundImage (assetPathUrl image) , backgroundRepeat noRepeat , backgroundPosition Css.center ] @@ -405,6 +405,11 @@ premiumLabelStyles image model = ) +assetPathUrl : Asset -> BackgroundImage {} +assetPathUrl = + url << Nri.Ui.AssetPath.Css.url + + indeterminateAttr : RootHtml.Attribute msg indeterminateAttr = RootAttributes.property "indeterminate" (Json.Encode.bool True) @@ -424,15 +429,6 @@ type ColorTheme | Gray - --- ICONS used instead of default browser implementations - - -backgroundImageDeprecated : Assets r -> CheckboxImage -> Css.Style -backgroundImageDeprecated assets checkboxImage = - property "background-image" (Nri.Ui.AssetPath.Css.url <| checkboxAssetPath assets checkboxImage) - - {-| The assets used in this module. -} type alias Assets r = @@ -445,34 +441,3 @@ type alias Assets r = , checkboxLockOnInside_svg : Asset , iconPremiumFlag_svg : Asset } - - -type CheckboxImage - = CheckboxUnchecked - | CheckboxChecked - | CheckboxCheckedPartially - | PremiumFlag - | PremiumLocked - | CheckboxLockOnInside - - -checkboxAssetPath : Assets r -> CheckboxImage -> Asset -checkboxAssetPath assets checkboxImage = - case checkboxImage of - CheckboxUnchecked -> - assets.checkboxUnchecked_svg - - CheckboxChecked -> - assets.checkboxChecked_svg - - CheckboxCheckedPartially -> - assets.checkboxCheckedPartially_svg - - PremiumLocked -> - assets.iconPremiumLocked_png - - CheckboxLockOnInside -> - assets.checkboxLockOnInside_svg - - PremiumFlag -> - assets.iconPremiumFlag_svg