11import React from 'react'
2- import { BetterSystemStyleObject , merge , SxProp } from '../sx'
32import { Box } from '..'
3+ import { ResponsiveValue , useResponsiveValue } from '../hooks/useResponsiveValue'
4+ import { BetterSystemStyleObject , merge , SxProp } from '../sx'
45
56const REGION_ORDER = {
67 header : 0 ,
@@ -178,18 +179,22 @@ const VerticalDivider: React.FC<DividerProps> = ({variant = 'none', variantWhenN
178179export type PageLayoutHeaderProps = {
179180 divider ?: 'none' | 'line'
180181 dividerWhenNarrow ?: 'inherit' | 'none' | 'line' | 'filled'
182+ hidden ?: boolean | ResponsiveValue < boolean >
181183} & SxProp
182184
183185const Header : React . FC < PageLayoutHeaderProps > = ( {
184186 divider = 'none' ,
185187 dividerWhenNarrow = 'inherit' ,
188+ hidden = false ,
186189 children,
187190 sx = { }
188191} ) => {
192+ const isHidden = useResponsiveValue ( hidden , false )
189193 const { rowGap} = React . useContext ( PageLayoutContext )
190194 return (
191195 < Box
192196 as = "header"
197+ hidden = { isHidden }
193198 sx = { merge < BetterSystemStyleObject > (
194199 {
195200 order : REGION_ORDER . header ,
@@ -216,6 +221,7 @@ Header.displayName = 'PageLayout.Header'
216221
217222export type PageLayoutContentProps = {
218223 width ?: keyof typeof contentWidths
224+ hidden ?: boolean | ResponsiveValue < boolean >
219225} & SxProp
220226
221227// TODO: Account for pane width when centering content
@@ -226,10 +232,12 @@ const contentWidths = {
226232 xlarge : '1280px'
227233}
228234
229- const Content : React . FC < PageLayoutContentProps > = ( { width = 'full' , children, sx = { } } ) => {
235+ const Content : React . FC < PageLayoutContentProps > = ( { width = 'full' , hidden = false , children, sx = { } } ) => {
236+ const isHidden = useResponsiveValue ( hidden , false )
230237 return (
231238 < Box
232239 as = "main"
240+ hidden = { isHidden }
233241 sx = { merge < BetterSystemStyleObject > (
234242 {
235243 order : REGION_ORDER . content ,
@@ -260,6 +268,7 @@ export type PageLayoutPaneProps = {
260268 width ?: keyof typeof paneWidths
261269 divider ?: 'none' | 'line'
262270 dividerWhenNarrow ?: 'inherit' | 'none' | 'line' | 'filled'
271+ hidden ?: boolean | ResponsiveValue < boolean >
263272} & SxProp
264273
265274const panePositions = {
@@ -279,9 +288,11 @@ const Pane: React.FC<PageLayoutPaneProps> = ({
279288 width = 'medium' ,
280289 divider = 'none' ,
281290 dividerWhenNarrow = 'inherit' ,
291+ hidden = false ,
282292 children,
283293 sx = { }
284294} ) => {
295+ const isHidden = useResponsiveValue ( hidden , false )
285296 const { rowGap, columnGap} = React . useContext ( PageLayoutContext )
286297 const computedPositionWhenNarrow = positionWhenNarrow === 'inherit' ? position : positionWhenNarrow
287298 const computedDividerWhenNarrow = dividerWhenNarrow === 'inherit' ? divider : dividerWhenNarrow
@@ -293,7 +304,7 @@ const Pane: React.FC<PageLayoutPaneProps> = ({
293304 merge < BetterSystemStyleObject > (
294305 {
295306 order : panePositions [ computedPositionWhenNarrow ] ,
296- display : 'flex' ,
307+ display : isHidden ? 'none' : 'flex' ,
297308 flexDirection : computedPositionWhenNarrow === 'end' ? 'column' : 'column-reverse' ,
298309 width : '100%' ,
299310 marginX : 0 ,
@@ -335,18 +346,22 @@ Pane.displayName = 'PageLayout.Pane'
335346export type PageLayoutFooterProps = {
336347 divider ?: 'none' | 'line'
337348 dividerWhenNarrow ?: 'inherit' | 'none' | 'line' | 'filled'
349+ hidden ?: boolean | ResponsiveValue < boolean >
338350} & SxProp
339351
340352const Footer : React . FC < PageLayoutFooterProps > = ( {
341353 divider = 'none' ,
342354 dividerWhenNarrow = 'inherit' ,
355+ hidden = false ,
343356 children,
344357 sx = { }
345358} ) => {
359+ const isHidden = useResponsiveValue ( hidden , false )
346360 const { rowGap} = React . useContext ( PageLayoutContext )
347361 return (
348362 < Box
349363 as = "footer"
364+ hidden = { isHidden }
350365 sx = { merge < BetterSystemStyleObject > (
351366 {
352367 order : REGION_ORDER . footer ,
0 commit comments