22
33import { Box , Flex } from '@devup-ui/react'
44import { usePathname , useSearchParams } from 'next/navigation'
5+ import { Suspense } from 'react'
56
67export function HeaderWrap ( { children } : { children : React . ReactNode } ) {
78 const path = usePathname ( )
89 const isRoot = path === '/'
9- const menu = useSearchParams ( ) . get ( 'menu' ) === '1'
1010 return (
1111 < Box
1212 pos = { isRoot ? 'fixed' : 'sticky' }
@@ -17,20 +17,31 @@ export function HeaderWrap({ children }: { children: React.ReactNode }) {
1717 w = "100%"
1818 zIndex = { 1 }
1919 >
20- < Flex
21- alignItems = "center"
22- bg = "$containerBackground"
23- borderRadius = { isRoot ? [ null , null , '16px' ] : undefined }
24- boxShadow = "0px 2px 8px 0px var(--shadow, rgba(135, 135, 135, 0.25))"
25- h = { [ '50px' , null , '70px' ] }
26- justifyContent = "space-between"
27- maxW = { isRoot ? '1440px' : '100%' }
28- mx = "auto"
29- pl = { [ menu ? null : 4 , 5 , '40px' ] }
30- pr = { [ null , 5 , '40px' ] }
31- >
32- { children }
33- </ Flex >
20+ < Suspense >
21+ < HeaderWrapInner > { children } </ HeaderWrapInner >
22+ </ Suspense >
3423 </ Box >
3524 )
3625}
26+
27+ function HeaderWrapInner ( { children } : { children : React . ReactNode } ) {
28+ const path = usePathname ( )
29+ const isRoot = path === '/'
30+ const menu = useSearchParams ( ) . get ( 'menu' ) === '1'
31+ return (
32+ < Flex
33+ alignItems = "center"
34+ bg = "$containerBackground"
35+ borderRadius = { isRoot ? [ null , null , '16px' ] : undefined }
36+ boxShadow = "0px 2px 8px 0px var(--shadow, rgba(135, 135, 135, 0.25))"
37+ h = { [ '50px' , null , '70px' ] }
38+ justifyContent = "space-between"
39+ maxW = { isRoot ? '1440px' : '100%' }
40+ mx = "auto"
41+ pl = { [ menu ? null : 4 , 5 , '40px' ] }
42+ pr = { [ null , 5 , '40px' ] }
43+ >
44+ { children }
45+ </ Flex >
46+ )
47+ }
0 commit comments