@@ -4,14 +4,16 @@ import { Box, Flex } from '@devup-ui/react'
44import { usePathname , useSearchParams } from 'next/navigation'
55import { Suspense } from 'react'
66
7+ import { isRoot } from '../../utils/is-root'
8+
79export function HeaderWrap ( { children } : { children : React . ReactNode } ) {
810 const path = usePathname ( )
9- const isRoot = path === '/'
11+ const root = isRoot ( path )
1012 return (
1113 < Box
12- pos = { isRoot ? 'fixed' : 'sticky' }
13- pt = { isRoot ? [ null , null , 5 ] : undefined }
14- px = { isRoot ? [ null , null , 4 ] : undefined }
14+ pos = { root ? 'fixed' : 'sticky' }
15+ pt = { root ? [ null , null , 5 ] : undefined }
16+ px = { root ? [ null , null , 4 ] : undefined }
1517 top = "0"
1618 transition = "all, 0.2s"
1719 w = "100%"
@@ -26,18 +28,17 @@ export function HeaderWrap({ children }: { children: React.ReactNode }) {
2628
2729function HeaderWrapInner ( { children } : { children : React . ReactNode } ) {
2830 const path = usePathname ( )
29- const isRoot = path === '/'
30- console . info ( 'isRoot' , isRoot , path )
31+ const root = isRoot ( path )
3132 const menu = useSearchParams ( ) . get ( 'menu' ) === '1'
3233 return (
3334 < Flex
3435 alignItems = "center"
3536 bg = "$containerBackground"
36- borderRadius = { isRoot ? [ null , null , '16px' ] : undefined }
37+ borderRadius = { root ? [ null , null , '16px' ] : undefined }
3738 boxShadow = "0px 2px 8px 0px var(--shadow, rgba(135, 135, 135, 0.25))"
3839 h = { [ '50px' , null , '70px' ] }
3940 justifyContent = "space-between"
40- maxW = { isRoot ? '1440px' : '100%' }
41+ maxW = { root ? '1440px' : '100%' }
4142 mx = "auto"
4243 pl = { [ menu ? null : 4 , 5 , '40px' ] }
4344 pr = { [ null , 5 , '40px' ] }
0 commit comments