Skip to content

Commit

Permalink
Re-enable PageLayout.EdgeToEdgeLayout
Browse files Browse the repository at this point in the history
  • Loading branch information
hojberg committed Jul 12, 2024
1 parent e120d3f commit 0961307
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/Code/FullyQualifiedName.elm
Original file line number Diff line number Diff line change
Expand Up @@ -267,11 +267,15 @@ extend a b =
|> append a


{-| prepend a single item onto the FQN segments
-}
cons : String -> FQN -> FQN
cons s (FQN segments_) =
FQN (NEL.cons s segments_)


{-| append a single item onto the FQN segments
-}
snoc : FQN -> String -> FQN
snoc (FQN segments_) s =
FQN (NEL.append segments_ (NEL.fromElement s))
Expand Down
31 changes: 31 additions & 0 deletions src/UI/PageLayout.elm
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ type PageLayout msg
| CenteredLayout (Layout {} msg)
| CenteredNarrowLayout (Layout {} msg)
| TabbedLayout (Layout { pageTitle : PageTitle msg, tabList : TabList msg } msg)
| EdgeToEdgeLayout (Layout {} msg)
| PresentationLayout (PageContent msg)


Expand Down Expand Up @@ -108,6 +109,15 @@ centeredNarrowLayout content footer =
}


edgeToEdgeLayout : PageContent msg -> PageFooter msg -> PageLayout msg
edgeToEdgeLayout content footer =
EdgeToEdgeLayout
{ content = content
, footer = footer
, backgroundColor = DefaultBackground
}


tabbedLayout : PageTitle msg -> TabList msg -> PageContent msg -> PageFooter msg -> PageLayout msg
tabbedLayout pageTitle tabList content footer =
TabbedLayout
Expand Down Expand Up @@ -150,6 +160,9 @@ withContent content pl =
CenteredNarrowLayout l ->
CenteredNarrowLayout (withContent_ l)

EdgeToEdgeLayout l ->
CenteredLayout (withContent_ l)

TabbedLayout l ->
TabbedLayout (withContent_ l)

Expand All @@ -175,6 +188,9 @@ withBackgroundColor bg pl =
CenteredNarrowLayout l ->
CenteredNarrowLayout { l | backgroundColor = bg }

EdgeToEdgeLayout l ->
CenteredNarrowLayout { l | backgroundColor = bg }

TabbedLayout _ ->
pl

Expand Down Expand Up @@ -249,6 +265,13 @@ map toMsg pageLayout =
, backgroundColor = layout.backgroundColor
}

EdgeToEdgeLayout layout ->
EdgeToEdgeLayout
{ content = PageContent.map toMsg layout.content
, footer = mapPageFooter toMsg layout.footer
, backgroundColor = layout.backgroundColor
}

TabbedLayout layout ->
TabbedLayout
{ pageTitle = PageTitle.map toMsg layout.pageTitle
Expand Down Expand Up @@ -357,6 +380,14 @@ view page =
[ PageContent.view_ (viewPageFooter footer) content
]

EdgeToEdgeLayout { content, footer, backgroundColor } ->
div
[ class "page edge-to-edge-layout"
, bgClassName backgroundColor
]
[ PageContent.view_ (viewPageFooter footer) content
]

TabbedLayout { pageTitle, tabList, content, footer, backgroundColor } ->
div
[ class "page tabbed-layout"
Expand Down
12 changes: 7 additions & 5 deletions src/css/ui/page-layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
--c-width_page-content_outer: calc(100vw - var(--c-width_sidebar));
}

.page.edge-to-edge-layout {
.page.centered-layout {
grid-template-columns: 1fr;
grid-template-areas: "page-content";
overflow: auto;
}

.page.centered-layout {
.page.centered-narrow-layout {
grid-template-columns: 1fr;
grid-template-areas: "page-content";
overflow: auto;
}

.page.centered-narrow-layout {
.page.edge-to-edge-layout {
grid-template-columns: 1fr;
grid-template-areas: "page-content";
overflow: auto;
Expand Down Expand Up @@ -235,7 +235,8 @@
margin-left: -0.75rem;
}

.page.sidebar-edge-to-edge-layout .page-content {
.page.sidebar-edge-to-edge-layout .page-content,
.page.edge-to-edge-layout .page-content {
padding: 0;
width: 100%;
align-items: normal;
Expand All @@ -246,7 +247,8 @@
* TODO: This reset seems bad...
* also depends on the .page-content reset of align-items ...
*/
.page.sidebar-edge-to-edge-layout .page-content .column {
.page.sidebar-edge-to-edge-layout .page-content .column,
.page.edge-to-edge-layout .page-content .column {
display: initial;
}

Expand Down

0 comments on commit 0961307

Please sign in to comment.