Skip to content

Commit e078535

Browse files
committed
feat(header): add ability to hide header based on localStorage
- Introduced state and effect to check localStorage for 'hideHeader' flag - Conditionally render null to hide the header when flag is set to 'true' - Improves user experience by allowing header visibility control
1 parent 3da8b02 commit e078535

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

web/app/components/header/header-wrapper.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
'use client'
2+
import { useEffect, useState } from 'react'
23
import { usePathname } from 'next/navigation'
34
import s from './index.module.css'
45
import classNames from '@/utils/classnames'
@@ -13,6 +14,18 @@ const HeaderWrapper = ({
1314
const pathname = usePathname()
1415
const isBordered = ['/apps', '/datasets', '/datasets/create', '/tools'].includes(pathname)
1516

17+
const [hideHeader, setHideHeader] = useState(false)
18+
19+
useEffect(() => {
20+
if (typeof window !== 'undefined') {
21+
if (localStorage.getItem('hideHeader') === 'true')
22+
setHideHeader(true)
23+
}
24+
}, [])
25+
26+
if (hideHeader)
27+
return null
28+
1629
return (
1730
<div className={classNames(
1831
'sticky top-0 left-0 right-0 z-30 flex flex-col grow-0 shrink-0 basis-auto min-h-[56px]',

0 commit comments

Comments
 (0)