From fe5cbf65bcbe87bd2ae0ecdc4e953b76c19d90d6 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Mon, 18 Apr 2022 18:05:57 -0700 Subject: [PATCH] Use Azure as expected --- src/Nri/Ui/Colors/Extra.elm | 8 ++++++++ src/Nri/Ui/SortableTable/V2.elm | 8 +------- src/Nri/Ui/Switch/V2.elm | 5 +++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/Nri/Ui/Colors/Extra.elm b/src/Nri/Ui/Colors/Extra.elm index 8f9dbda1..ca296ee6 100644 --- a/src/Nri/Ui/Colors/Extra.elm +++ b/src/Nri/Ui/Colors/Extra.elm @@ -1,6 +1,7 @@ module Nri.Ui.Colors.Extra exposing ( toCssColor, fromCssColor , withAlpha + , toCssString ) {-| Helpers for working with colors. @@ -10,6 +11,7 @@ module Nri.Ui.Colors.Extra exposing @docs toCssColor, fromCssColor @docs withAlpha +@docs toCssString -} @@ -44,3 +46,9 @@ withAlpha 0.5 grassland -- "{ value = "rgba(86, 191, 116, 0.5)", color = Compati withAlpha : Float -> Css.Color -> Css.Color withAlpha alpha { red, green, blue } = Css.rgba red green blue alpha + + +{-| -} +toCssString : Css.Color -> String +toCssString = + SolidColor.toRGBString << fromCssColor diff --git a/src/Nri/Ui/SortableTable/V2.elm b/src/Nri/Ui/SortableTable/V2.elm index e6905371..477fb113 100644 --- a/src/Nri/Ui/SortableTable/V2.elm +++ b/src/Nri/Ui/SortableTable/V2.elm @@ -21,11 +21,10 @@ import Css exposing (..) import Html.Styled as Html exposing (Html) import Html.Styled.Attributes exposing (css) import Html.Styled.Events -import Nri.Ui.Colors.Extra +import Nri.Ui.Colors.Extra exposing (toCssString) import Nri.Ui.Colors.V1 import Nri.Ui.CssVendorPrefix.V1 as CssVendorPrefix import Nri.Ui.Table.V5 -import SolidColor import Svg.Styled as Svg import Svg.Styled.Attributes as SvgAttributes @@ -363,8 +362,3 @@ sortArrow direction active = [ Svg.polygon [ SvgAttributes.points "0 6 4 0 8 6 0 6" ] [] ] ] - - -toCssString : Css.Color -> String -toCssString = - SolidColor.toRGBString << Nri.Ui.Colors.Extra.fromCssColor diff --git a/src/Nri/Ui/Switch/V2.elm b/src/Nri/Ui/Switch/V2.elm index a9e42c26..c1e2746d 100644 --- a/src/Nri/Ui/Switch/V2.elm +++ b/src/Nri/Ui/Switch/V2.elm @@ -13,6 +13,7 @@ module Nri.Ui.Switch.V2 exposing - Fixes invalid ARIA use, [conformance requirements](https://www.w3.org/TR/html-aria/#docconformance) - labels should only support strings (this is the only way they're actually used in practice) - extends API to be more consistent with other form/control components + - Use Colors.azure instead of a hardcoded hex @docs view, label @@ -34,6 +35,7 @@ import Css.Media import Html.Styled as WildWildHtml import Html.Styled.Attributes as Attributes import Html.Styled.Events as Events +import Nri.Ui.Colors.Extra exposing (toCssString) import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Html.Attributes.V2 as Extra import Nri.Ui.Svg.V1 exposing (Svg) @@ -164,8 +166,7 @@ view attrs isOn = , Css.pseudoClass "focus-within" [ Global.descendants [ Global.class "switch-slider" - [ -- azure, but can't use the Color type here - Css.property "stroke" "#146AFF" + [ Css.property "stroke" (toCssString Colors.azure) , Css.property "stroke-width" "3px" ] ]