mirror of
https://github.com/NoRedInk/noredink-ui.git
synced 2025-01-06 22:49:38 +03:00
🎨 clean up how logic is passed around
This commit is contained in:
parent
a8e577d19b
commit
1441c5e5d8
@ -77,7 +77,7 @@ view config (State { currentPanelIndex, previousPanel }) =
|
|||||||
case Maybe.andThen (summarize config.panels) currentPanelIndex of
|
case Maybe.andThen (summarize config.panels) currentPanelIndex of
|
||||||
Just summary ->
|
Just summary ->
|
||||||
viewBackdrop
|
viewBackdrop
|
||||||
(viewModal config.height previousPanel (viewPanels config.parentMsg summary))
|
(viewModal config previousPanel summary)
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
Html.text ""
|
Html.text ""
|
||||||
@ -126,8 +126,12 @@ summarize panels current =
|
|||||||
Nothing
|
Nothing
|
||||||
|
|
||||||
|
|
||||||
viewModal : Css.Vh -> Maybe ( Direction, Panel ) -> ( String, List (Html msg) ) -> Html msg
|
viewModal : Config msg -> Maybe ( Direction, Panel ) -> Summary -> Html msg
|
||||||
viewModal height previous ( labelledById, panel ) =
|
viewModal config previous summary =
|
||||||
|
let
|
||||||
|
( labelledById, currentPanel ) =
|
||||||
|
viewCurrentPanel config.parentMsg summary
|
||||||
|
in
|
||||||
Keyed.node "div"
|
Keyed.node "div"
|
||||||
[ css
|
[ css
|
||||||
[ Css.width (Css.px 600)
|
[ Css.width (Css.px 600)
|
||||||
@ -144,11 +148,12 @@ viewModal height previous ( labelledById, panel ) =
|
|||||||
(case previous of
|
(case previous of
|
||||||
Just ( direction, previousPanel ) ->
|
Just ( direction, previousPanel ) ->
|
||||||
[ viewPreviousPanel direction previousPanel
|
[ viewPreviousPanel direction previousPanel
|
||||||
, ( labelledById, panelContainer height direction panel )
|
, ( labelledById, panelContainer config.height direction currentPanel )
|
||||||
]
|
]
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
[ ( labelledById, panelContainer height FromRTL panel ) ]
|
[ ( labelledById, panelContainer config.height FromRTL currentPanel )
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -282,8 +287,8 @@ type alias Panel =
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
viewPanels : (State -> msg) -> Summary -> ( String, List (Html msg) )
|
viewCurrentPanel : (State -> msg) -> Summary -> ( String, List (Html msg) )
|
||||||
viewPanels parentMsg ({ current } as summary) =
|
viewCurrentPanel parentMsg ({ current } as summary) =
|
||||||
( panelId current
|
( panelId current
|
||||||
, [ viewIcon current.icon
|
, [ viewIcon current.icon
|
||||||
, Text.subHeading
|
, Text.subHeading
|
||||||
|
Loading…
Reference in New Issue
Block a user