calculate the title styles at the end

This commit is contained in:
Tessa Kelly 2020-09-02 13:37:24 -07:00
parent 92f15f6796
commit d2dc009b10

View File

@ -423,7 +423,6 @@ type alias Attributes =
{ overlayColor : Color { overlayColor : Color
, titleColor : Color , titleColor : Color
, visibleTitle : Bool , visibleTitle : Bool
, titleStyles : List Style
, customStyles : List Style , customStyles : List Style
, customAttributes : List (Html.Attribute Never) , customAttributes : List (Html.Attribute Never)
} }
@ -434,7 +433,6 @@ defaultAttributes =
{ overlayColor = Nri.Ui.Colors.Extra.withAlpha 0.9 Colors.navy { overlayColor = Nri.Ui.Colors.Extra.withAlpha 0.9 Colors.navy
, titleColor = Colors.navy , titleColor = Colors.navy
, visibleTitle = True , visibleTitle = True
, titleStyles = []
, customStyles = [] , customStyles = []
, customAttributes = [] , customAttributes = []
} }
@ -460,11 +458,8 @@ buildAttributes attrs =
Batch functions -> Batch functions ->
List.foldl applyAttrs acc functions List.foldl applyAttrs acc functions
result =
List.foldl applyAttrs defaultAttributes attrs
in in
{ result | titleStyles = titleStyles result.titleColor result.visibleTitle } List.foldl applyAttrs defaultAttributes attrs
modalStyles : List Style modalStyles : List Style
@ -551,8 +546,8 @@ view config attrsList model =
{ title = config.title { title = config.title
, wrapMsg = config.wrapMsg , wrapMsg = config.wrapMsg
, focusManager = config.focusManager , focusManager = config.focusManager
, titleColor = attrs.titleColor
, visibleTitle = attrs.visibleTitle , visibleTitle = attrs.visibleTitle
, titleStyles = attrs.titleStyles
, customAttributes = attrs.customAttributes , customAttributes = attrs.customAttributes
} }
] ]
@ -587,8 +582,8 @@ viewModal :
{ title : String { title : String
, wrapMsg : Msg -> msg , wrapMsg : Msg -> msg
, focusManager : FocusManager msg , focusManager : FocusManager msg
, titleColor : Color
, visibleTitle : Bool , visibleTitle : Bool
, titleStyles : List Style
, customAttributes : List (Html.Attribute Never) , customAttributes : List (Html.Attribute Never)
} }
-> Html msg -> Html msg
@ -602,7 +597,7 @@ viewModal config =
) )
[ h1 [ h1
[ id modalTitleId [ id modalTitleId
, Attrs.css config.titleStyles , Attrs.css (titleStyles config.titleColor config.visibleTitle)
] ]
[ text config.title ] [ text config.title ]
, viewContent config.visibleTitle <| , viewContent config.visibleTitle <|