From d2dc009b1035c37efc1c56f7fdd9f3bf19d49253 Mon Sep 17 00:00:00 2001 From: Tessa Kelly Date: Wed, 2 Sep 2020 13:37:24 -0700 Subject: [PATCH] calculate the title styles at the end --- src/Nri/Ui/Modal/V11.elm | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Nri/Ui/Modal/V11.elm b/src/Nri/Ui/Modal/V11.elm index 68b8041e..f71343b7 100644 --- a/src/Nri/Ui/Modal/V11.elm +++ b/src/Nri/Ui/Modal/V11.elm @@ -423,7 +423,6 @@ type alias Attributes = { overlayColor : Color , titleColor : Color , visibleTitle : Bool - , titleStyles : List Style , customStyles : List Style , customAttributes : List (Html.Attribute Never) } @@ -434,7 +433,6 @@ defaultAttributes = { overlayColor = Nri.Ui.Colors.Extra.withAlpha 0.9 Colors.navy , titleColor = Colors.navy , visibleTitle = True - , titleStyles = [] , customStyles = [] , customAttributes = [] } @@ -460,11 +458,8 @@ buildAttributes attrs = Batch functions -> List.foldl applyAttrs acc functions - - result = - List.foldl applyAttrs defaultAttributes attrs in - { result | titleStyles = titleStyles result.titleColor result.visibleTitle } + List.foldl applyAttrs defaultAttributes attrs modalStyles : List Style @@ -551,8 +546,8 @@ view config attrsList model = { title = config.title , wrapMsg = config.wrapMsg , focusManager = config.focusManager + , titleColor = attrs.titleColor , visibleTitle = attrs.visibleTitle - , titleStyles = attrs.titleStyles , customAttributes = attrs.customAttributes } ] @@ -587,8 +582,8 @@ viewModal : { title : String , wrapMsg : Msg -> msg , focusManager : FocusManager msg + , titleColor : Color , visibleTitle : Bool - , titleStyles : List Style , customAttributes : List (Html.Attribute Never) } -> Html msg @@ -602,7 +597,7 @@ viewModal config = ) [ h1 [ id modalTitleId - , Attrs.css config.titleStyles + , Attrs.css (titleStyles config.titleColor config.visibleTitle) ] [ text config.title ] , viewContent config.visibleTitle <|