mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2024-11-28 01:45:20 +03:00
Lock-in the modal height in the configuration
This commit is contained in:
parent
c58e892573
commit
aedbb9e6a3
@ -28,6 +28,7 @@ import Nri.Ui.Text.V2 as Text
|
||||
|
||||
type alias Config msg =
|
||||
{ panels : List (Panel msg)
|
||||
, height : Css.Vh
|
||||
, parentMsg : State -> msg
|
||||
}
|
||||
|
||||
@ -49,16 +50,16 @@ closed =
|
||||
view : Config msg -> State -> Html msg
|
||||
view config (State state) =
|
||||
Maybe.andThen (viewPanels config.parentMsg config.panels) state
|
||||
|> Maybe.map (viewModal >> viewBackdrop)
|
||||
|> Maybe.map (viewModal config.height >> viewBackdrop)
|
||||
|> Maybe.withDefault (Html.text "")
|
||||
|
||||
|
||||
viewModal : ( String, List (Html msg) ) -> Html msg
|
||||
viewModal ( labelledById, panels ) =
|
||||
viewModal : Css.Vh -> ( String, List (Html msg) ) -> Html msg
|
||||
viewModal height ( labelledById, panels ) =
|
||||
Nri.Ui.styled div
|
||||
"modal-container"
|
||||
[ Css.width (Css.px 600)
|
||||
, Css.minHeight (Css.px 400)
|
||||
, Css.height height
|
||||
, Css.maxHeight <| Css.calc (Css.vh 100) Css.minus (Css.px 100)
|
||||
, Css.padding4 (Css.px 35) Css.zero (Css.px 25) Css.zero
|
||||
, Css.margin2 (Css.px 75) Css.auto
|
||||
|
@ -98,6 +98,7 @@ viewModal state =
|
||||
, buttonLabel = "Let's get to it!"
|
||||
}
|
||||
]
|
||||
, height = Css.vh 60
|
||||
, parentMsg = ModalMsg
|
||||
}
|
||||
state
|
||||
|
Loading…
Reference in New Issue
Block a user