From ccb7f01c527aa97406971e229e266e6104485a68 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Wed, 27 Oct 2021 12:26:40 -0700 Subject: [PATCH] Make noBreak setting a bit more clear --- src/Nri/Ui/Text/V6.elm | 12 ++++++++---- styleguide-app/Examples/Text.elm | 14 ++------------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/Nri/Ui/Text/V6.elm b/src/Nri/Ui/Text/V6.elm index 13804bc4..0c4c4b2f 100644 --- a/src/Nri/Ui/Text/V6.elm +++ b/src/Nri/Ui/Text/V6.elm @@ -11,6 +11,7 @@ module Nri.Ui.Text.V6 exposing - adds helpers: `custom`, `nriDescription`,`testId`,`id` - instead of view helpers that take HTML, offer attribute helpers supporting plaintext, markdown, and html content - :skull: remove noWidow, which is not used + - noBreak now takes a bool ## Understanding spacing @@ -88,11 +89,14 @@ buildSettings = List.foldl (\(Attribute f) acc -> f acc) defaultSettings -{-| Text with this attribute will never wrap. +{-| Pass True to prevent text from ever wrapping. + +The default Text behavior is `noBreak False`, which means content will wrap. + -} -noBreak : Attribute msg -noBreak = - Attribute (\config -> { config | noBreak = True }) +noBreak : Bool -> Attribute msg +noBreak noBreak_ = + Attribute (\config -> { config | noBreak = noBreak_ }) {-| Use this helper to add custom attributes. diff --git a/styleguide-app/Examples/Text.elm b/styleguide-app/Examples/Text.elm index 18de4743..63c3c176 100644 --- a/styleguide-app/Examples/Text.elm +++ b/styleguide-app/Examples/Text.elm @@ -57,18 +57,6 @@ example = [ Text.css [ Css.padding (Css.px 20) ] , Text.plaintext "I've got more padding than my siblings!" ] - , Html.div - [ Attributes.css - [ Css.width (Css.px 80) - , Css.border3 (Css.px 1) Css.solid (Css.hex "000") - ] - ] - [ Text.mediumBody - [ Text.noBreak - , Text.plaintext - "I won't ever break, no matter how narrow my container is." - ] - ] ] } @@ -100,6 +88,8 @@ init = { control = ControlExtra.list |> ControlExtra.listItem "content" controlContent + |> ControlExtra.listItem "noBreak" + (Control.map Text.noBreak (Control.bool False)) }