Skip to content

Commit 26340a3

Browse files
authored
Merge pull request #66 from dev-five-git/add-svg
Add svg
2 parents 861c3a4 + dd72d5c commit 26340a3

File tree

3 files changed

+47
-30
lines changed

3 files changed

+47
-30
lines changed

apps/landing/src/components/Header/HeaderWrap.tsx

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
import { Box, Flex } from '@devup-ui/react'
44
import { usePathname, useSearchParams } from 'next/navigation'
5+
import { Suspense } from 'react'
56

67
export 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+
}

apps/landing/src/components/Header/index.tsx

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { css, Flex } from '@devup-ui/react'
22
import Link from 'next/link'
3+
import { Suspense } from 'react'
34

45
import { URL_PREFIX } from '../../constants'
56
import { Logo } from '../Logo'
@@ -31,16 +32,18 @@ export function Header() {
3132
return (
3233
<HeaderWrap>
3334
<Flex alignItems="center" gap="16px">
34-
<MobMenuWrapper openChildren={top}>
35-
<Link
36-
className={css({
37-
textDecoration: 'none',
38-
})}
39-
href={URL_PREFIX + '/'}
40-
>
41-
<Logo />
42-
</Link>
43-
</MobMenuWrapper>
35+
<Suspense>
36+
<MobMenuWrapper openChildren={top}>
37+
<Link
38+
className={css({
39+
textDecoration: 'none',
40+
})}
41+
href={URL_PREFIX + '/'}
42+
>
43+
<Logo />
44+
</Link>
45+
</MobMenuWrapper>
46+
</Suspense>
4447
</Flex>
4548
<Flex alignItems="center" display={['none', null, 'flex']} gap="10px">
4649
<Flex alignItems="center" px="24px">
@@ -75,9 +78,11 @@ export function Header() {
7578
gap="10px"
7679
p="10px"
7780
>
78-
<MobMenuButton>
79-
<MobMenu />
80-
</MobMenuButton>
81+
<Suspense fallback={<MobMenu />}>
82+
<MobMenuButton>
83+
<MobMenu />
84+
</MobMenuButton>
85+
</Suspense>
8186
</Flex>
8287
</HeaderWrap>
8388
)
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import type { Property } from 'csstype'
22

33
import type { ResponsiveValue } from '../responsive-value'
4+
import type { DevupThemeColors } from '../theme'
45

56
export interface DevupUiSvgProps {
6-
fill?: ResponsiveValue<Property.Fill>
7-
stroke?: ResponsiveValue<Property.Stroke>
7+
fill?: ResponsiveValue<Property.Fill | keyof DevupThemeColors>
8+
stroke?: ResponsiveValue<Property.Stroke | keyof DevupThemeColors>
89
strokeWidth?: ResponsiveValue<Property.StrokeWidth>
910
strokeOpacity?: ResponsiveValue<Property.StrokeOpacity>
1011
}

0 commit comments

Comments
 (0)