From 0e33fe430602afd5d30b29c034822cc67664f3ef Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Fri, 28 Jan 2022 09:24:40 -0800 Subject: [PATCH] Fix ClickableText minor visual regression --- src/Nri/Ui/ClickableText/V3.elm | 16 +++++++--------- styleguide-app/Examples/ClickableText.elm | 7 ++++--- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Nri/Ui/ClickableText/V3.elm b/src/Nri/Ui/ClickableText/V3.elm index 620662a9..01e71990 100644 --- a/src/Nri/Ui/ClickableText/V3.elm +++ b/src/Nri/Ui/ClickableText/V3.elm @@ -76,7 +76,7 @@ import Nri.Ui import Nri.Ui.Colors.V1 as Colors import Nri.Ui.Fonts.V1 import Nri.Ui.Html.Attributes.V2 as ExtraAttributes -import Nri.Ui.Svg.V1 as NriSvg exposing (Svg) +import Nri.Ui.Svg.V1 as Svg exposing (Svg) label : String -> Attribute msg @@ -294,12 +294,11 @@ viewContent config = , Css.property "line-height" "normal" ] ] - [ div - [ Attributes.css - [ Css.height fontSize - , Css.maxWidth fontSize - , Css.minWidth fontSize -- so it doesn't shrink when the label is long - , case config.size of + [ icon_ + |> Svg.withWidth fontSize + |> Svg.withHeight fontSize + |> Svg.withCss + [ case config.size of Small -> Css.marginRight (Css.px 3) @@ -309,8 +308,7 @@ viewContent config = Large -> Css.marginRight (Css.px 4) ] - ] - [ NriSvg.toHtml icon_ ] + |> Svg.toHtml , span [] [ text config.label ] ] ] diff --git a/styleguide-app/Examples/ClickableText.elm b/styleguide-app/Examples/ClickableText.elm index 8a288cef..1dd43010 100644 --- a/styleguide-app/Examples/ClickableText.elm +++ b/styleguide-app/Examples/ClickableText.elm @@ -64,9 +64,10 @@ init = |> Control.field "icon" (Control.maybe True <| Control.choice - [ ( "Preview", Control.value UiIcon.preview ) - , ( "Performance", Control.value UiIcon.performance ) - , ( "Edit", Control.value UiIcon.edit ) + [ ( "premiumLock", Control.value UiIcon.premiumLock ) + , ( "preview", Control.value UiIcon.preview ) + , ( "performance", Control.value UiIcon.performance ) + , ( "edit", Control.value UiIcon.edit ) ] ) |> State