(frontend) support screen titles with colorful page headers

Added support for passing screen titles that display in colorful header
components, improving page navigation context and visual hierarchy.
This commit is contained in:
lebaudantoine
2025-03-10 19:18:35 +01:00
committed by aleb_the_flash
parent 74aba2185a
commit b4016ce850

View File

@@ -2,6 +2,8 @@ import { layoutStore } from '@/stores/layout'
import { Layout } from './Layout'
import { useEffect } from 'react'
import { Centered } from './Centered'
import { H } from '@/primitives'
import { css } from '@/styled-system/css'
export type ScreenProps = {
/**
@@ -14,6 +16,7 @@ export type ScreenProps = {
*/
header?: boolean
footer?: boolean
headerTitle?: string
children: React.ReactNode
}
@@ -21,6 +24,7 @@ export const Screen = ({
layout = 'fullpage',
header = true,
footer = true,
headerTitle,
children,
}: ScreenProps) => {
useEffect(() => {
@@ -31,5 +35,40 @@ export const Screen = ({
layoutStore.showFooter = footer
}
}, [header, footer])
return layout === 'centered' ? <Centered>{children}</Centered> : children
return (
<>
{headerTitle && (
<div
className={css({
backgroundColor: 'primary.100',
width: '100%',
})}
>
<div
className={css({
maxWidth: '100%',
width: '38rem',
margin: 'auto',
paddingX: '2rem',
})}
>
<H
lvl={1}
margin={false}
className={css({
paddingY: '2rem',
md: {
paddingY: '3rem',
},
})}
>
{headerTitle}
</H>
</div>
</div>
)}
{layout === 'centered' ? <Centered>{children}</Centered> : children}
</>
)
}