From 88b6020a9a9771925c5d8b9850458a95e6e12bf8 Mon Sep 17 00:00:00 2001 From: Jasper Woudenberg Date: Wed, 20 Jun 2018 15:28:20 +0100 Subject: [PATCH] Handle some Elm compilation warnings --- src/Nri/Ui/Checkbox/V3.elm | 6 +-- src/Nri/Ui/PremiumCheckbox/V1.elm | 75 +++++++++++++++---------------- 2 files changed, 38 insertions(+), 43 deletions(-) diff --git a/src/Nri/Ui/Checkbox/V3.elm b/src/Nri/Ui/Checkbox/V3.elm index 5e7d7e93..91a3e69d 100644 --- a/src/Nri/Ui/Checkbox/V3.elm +++ b/src/Nri/Ui/Checkbox/V3.elm @@ -22,14 +22,11 @@ import Accessibility.Styled.Style import Accessibility.Styled.Widget as Widget import Css exposing (..) import Css.Foreign exposing (Snippet, children, descendants, everything, selector) -import Html as RootHtml -import Html.Attributes as RootAttributes import Html.Events exposing (defaultOptions) -import Html.Styled exposing (fromUnstyled, toUnstyled) +import Html.Styled import Html.Styled.Attributes as Attributes exposing (css) import Html.Styled.Events as Events import Json.Decode -import Json.Encode import Nri.Ui.AssetPath exposing (Asset(..)) import Nri.Ui.AssetPath.Css import Nri.Ui.Colors.V1 as Colors @@ -326,6 +323,7 @@ type alias Assets r = } +backgroundImage : Asset -> Style backgroundImage = Nri.Ui.AssetPath.Css.url >> property "background-image" diff --git a/src/Nri/Ui/PremiumCheckbox/V1.elm b/src/Nri/Ui/PremiumCheckbox/V1.elm index 32e80d07..de901205 100644 --- a/src/Nri/Ui/PremiumCheckbox/V1.elm +++ b/src/Nri/Ui/PremiumCheckbox/V1.elm @@ -1,9 +1,6 @@ module Nri.Ui.PremiumCheckbox.V1 exposing (PremiumConfig, premium) -{-| - -@docs PremiumConfig, premium - +{-| @docs PremiumConfig, premium -} import Accessibility.Styled as Html @@ -20,7 +17,6 @@ import Nri.Ui.Data.PremiumLevel as PremiumLevel exposing (PremiumLevel(..)) - `onChange`: A message for when the user toggles the checkbox - `onLockedClick`: A message for when the user clicks a checkbox they don't have PremiumLevel for. If you get this message, you should show an `Nri.Ui.Premium.Model.view` - -} type alias PremiumConfig msg = { label : String @@ -58,41 +54,41 @@ premium assets config = else Checkbox.Square Checkbox.Default in - Html.span [] - [ Checkbox.viewWithLabel assets - { identifier = config.id - , label = config.label - , setterMsg = - if isLocked then - \_ -> config.onLockedClick - else - config.onChange - , selected = config.selected - , disabled = config.disabled - , theme = theme - , noOpMsg = config.noOpMsg - } - , if - (isLocked && config.showFlagWhenLocked) - || (not isLocked && config.contentPremiumLevel /= Free) - then - Html.div - [ Attributes.class "checkbox-PremiumClass" - , css - [ property "content" "''" - , display inlineBlock - , width (px 26) - , height (px 24) - , marginLeft (px 8) - , backgroundImage assets.iconPremiumFlag_svg - , backgroundRepeat noRepeat - , backgroundPosition Css.center + Html.span [] + [ Checkbox.viewWithLabel assets + { identifier = config.id + , label = config.label + , setterMsg = + if isLocked then + \_ -> config.onLockedClick + else + config.onChange + , selected = config.selected + , disabled = config.disabled + , theme = theme + , noOpMsg = config.noOpMsg + } + , if + (isLocked && config.showFlagWhenLocked) + || (not isLocked && config.contentPremiumLevel /= Free) + then + Html.div + [ Attributes.class "checkbox-PremiumClass" + , css + [ property "content" "''" + , display inlineBlock + , width (px 26) + , height (px 24) + , marginLeft (px 8) + , backgroundImage assets.iconPremiumFlag_svg + , backgroundRepeat noRepeat + , backgroundPosition Css.center + ] ] - ] - [] - else - Html.text "" - ] + [] + else + Html.text "" + ] {-| The assets used in this module. @@ -107,6 +103,7 @@ type alias Assets r = } +backgroundImage : Asset -> Style backgroundImage = Nri.Ui.AssetPath.Css.url >> property "background-image"