Skip to content

Commit ef8e63e

Browse files
committed
Refactor landing
1 parent 94681ff commit ef8e63e

File tree

15 files changed

+55
-76
lines changed

15 files changed

+55
-76
lines changed

apps/landing/src/app/(detail)/docs/MenuItem.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { Box, css, Flex, Text } from '@devup-ui/react'
33
import Link from 'next/link'
44
import { usePathname } from 'next/navigation'
55

6-
import { URL_PREFIX } from '../../../constants'
76
import { OpenMenuItem } from './OpenMenuItem'
87

98
export interface MenuItemProps {
@@ -19,12 +18,8 @@ export function MenuItem(props: MenuItemProps) {
1918
const { children, to, subMenu } = props
2019
const path = usePathname()
2120
const selected = to
22-
? path.startsWith(to) || path.startsWith(URL_PREFIX + to)
23-
: !!subMenu?.some((item) =>
24-
item.to
25-
? path.startsWith(URL_PREFIX + item.to) || path.startsWith(item.to)
26-
: false,
27-
)
21+
? path.startsWith(to)
22+
: !!subMenu?.some((item) => (item.to ? path.startsWith(item.to) : false))
2823

2924
if (subMenu) return <OpenMenuItem {...props} subMenu={subMenu} />
3025
const inner = (
@@ -61,7 +56,7 @@ export function MenuItem(props: MenuItemProps) {
6156
className={css({
6257
textDecoration: 'none',
6358
})}
64-
href={URL_PREFIX + to}
59+
href={to}
6560
>
6661
{inner}
6762
</Link>

apps/landing/src/app/(detail)/docs/OpenMenuItem.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import Link from 'next/link'
44
import { usePathname } from 'next/navigation'
55
import { Fragment, useReducer } from 'react'
66

7-
import { URL_PREFIX } from '../../../constants'
87
import { MenuItemProps } from './MenuItem'
98

109
export function OpenMenuItem({
@@ -14,9 +13,7 @@ export function OpenMenuItem({
1413
Required<Pick<MenuItemProps, 'subMenu'>>) {
1514
const path = usePathname()
1615
const selected = subMenu.some((item) =>
17-
item.to
18-
? path.startsWith(URL_PREFIX + item.to) || path.startsWith(item.to)
19-
: false,
16+
item.to ? path.startsWith(item.to) : false,
2017
)
2118
const [open, handleOpen] = useReducer((state) => !state, selected)
2219
return (
@@ -45,7 +42,7 @@ export function OpenMenuItem({
4542
{subMenu && (
4643
<Image
4744
boxSize="16px"
48-
src={URL_PREFIX + '/menu-arrow.svg'}
45+
src="/menu-arrow.svg"
4946
transform={open ? 'rotate(0deg)' : 'rotate(-90deg)'}
5047
transition="transform 0.2s"
5148
/>
@@ -56,9 +53,7 @@ export function OpenMenuItem({
5653
<Box borderRight="1px solid var(--border, #E0E0E0)" w="10px" />
5754
<VStack flex="1" gap="4px">
5855
{subMenu.map(({ children, to }, idx) => {
59-
const selected = to
60-
? path.startsWith(to) || path.startsWith(URL_PREFIX + to)
61-
: false
56+
const selected = to ? path.startsWith(to) : false
6257
const inner = (
6358
<Flex
6459
_hover={{
@@ -90,7 +85,7 @@ export function OpenMenuItem({
9085
className={css({
9186
textDecoration: 'none',
9287
})}
93-
href={URL_PREFIX + to}
88+
href={to}
9489
>
9590
{inner}
9691
</Link>

apps/landing/src/app/FeatureCard.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Flex, Image, Text, VStack } from '@devup-ui/react'
22

3-
import { URL_PREFIX } from '../constants'
4-
53
interface FeatureCardProps {
64
title: string
75
description: string
@@ -12,7 +10,7 @@ export function FeatureCard({ icon, description, title }: FeatureCardProps) {
1210
return (
1311
<Flex bg="$cardBg" borderRadius="20px" flex="1" gap="10px" p="24px">
1412
<Flex px="8px">
15-
<Image boxSize="32px" src={URL_PREFIX + icon} />
13+
<Image boxSize="32px" src={icon} />
1614
</Flex>
1715
<VStack flex="1" gap="10px">
1816
<Text color="$title" typography="h6">

apps/landing/src/app/layout.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { Metadata } from 'next'
77
import { Footer } from '../components/Footer'
88
import { Header } from '../components/Header'
99
import { SearchModal } from '../components/SearchModal'
10-
import { URL_PREFIX } from '../constants'
1110

1211
export const metadata: Metadata = {
1312
title: 'Devup UI',
@@ -22,17 +21,35 @@ export default function RootLayout({
2221
return (
2322
<html lang="en" suppressHydrationWarning>
2423
<head>
24+
<script
25+
dangerouslySetInnerHTML={{
26+
__html: `<!-- Google Tag Manager -->
27+
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
28+
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
29+
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
30+
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
31+
})(window,document,'script','dataLayer','GTM-PSRKC4QZ');</script>
32+
<!-- End Google Tag Manager -->`,
33+
}}
34+
/>
2535
<ThemeScript auto />
2636
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
27-
{URL_PREFIX && <base href={URL_PREFIX} />}
28-
<link href={URL_PREFIX + '/favicon.ico'} rel="shortcut icon" />
37+
<link href="/favicon.ico" rel="shortcut icon" />
2938
</head>
3039
<body
3140
className={css({
3241
bg: '$background',
3342
color: '$text',
3443
})}
3544
>
45+
<noscript>
46+
<iframe
47+
height="0"
48+
src="https://www.googletagmanager.com/ns.html?id=GTM-PSRKC4QZ"
49+
style={{ display: 'none', visibility: 'hidden' }}
50+
width="0"
51+
/>
52+
</noscript>
3653
<SearchModal />
3754
<Header />
3855
{children}

apps/landing/src/app/page.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ import Link from 'next/link'
44
import { CodeBoard } from '../components/CodeBoard'
55
import { Container } from '../components/Container'
66
import { Discord } from '../components/Discord'
7-
import { URL_PREFIX } from '../constants'
87
import { FeatureCard } from './FeatureCard'
98

109
export default function HomePage() {
1110
return (
1211
<>
12+
<link href="https://devup-ui.com" rel="canonical" />
1313
<Box
1414
h="80dvh"
1515
pointerEvents="none"
@@ -66,7 +66,7 @@ export default function HomePage() {
6666
<Box pt={['100px', '150px']}>
6767
<VStack alignItems="center" gap="50px" maxW="800px" mx="auto">
6868
<VStack alignItems="center" gap="24px">
69-
<Image h="50px" src={URL_PREFIX + '/icon.svg'} w="52px" />
69+
<Image h="50px" src="/icon.svg" w="52px" />
7070
<Text color="$title" textAlign="center" typography="h1">
7171
Zero Config, Zero FOUC, Zero Runtime, CSS in JS Preprocessor
7272
</Text>
@@ -81,7 +81,7 @@ export default function HomePage() {
8181
className={css({
8282
textDecoration: 'none',
8383
})}
84-
href={URL_PREFIX + '/docs/overview'}
84+
href="/docs/overview"
8585
>
8686
<Flex
8787
_active={{
@@ -112,11 +112,7 @@ export default function HomePage() {
112112
<Text color="$base" typography="buttonL">
113113
Get started
114114
</Text>
115-
<Image
116-
bg="$base"
117-
boxSize="24px"
118-
maskImage={`url(${URL_PREFIX + '/arrow.svg'})`}
119-
/>
115+
<Image bg="$base" boxSize="24px" maskImage="url(/arrow.svg)" />
120116
</Flex>
121117
</Flex>
122118
</Link>

apps/landing/src/components/Discord.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
import { css, Flex, Image, Text, VStack } from '@devup-ui/react'
22
import Link from 'next/link'
33

4-
import { URL_PREFIX } from '../constants'
5-
64
export function Discord() {
75
return (
86
<VStack
97
alignItems="center"
108
bgColor="$joinBg"
11-
bgImage={`url(${URL_PREFIX}/discord-bg.svg)`}
9+
bgImage="url(/discord-bg.svg)"
1210
bgPositionX={['-20vw', null, '-30%']}
1311
bgPositionY="bottom"
1412
bgSize={['contain', null, '70%']}
@@ -56,7 +54,7 @@ export function Discord() {
5654
<Text color="#FFF" typography="buttonLbold">
5755
Join our Discord
5856
</Text>
59-
<Image boxSize="24px" src={URL_PREFIX + '/outlink.svg'} />
57+
<Image boxSize="24px" src="/outlink.svg" />
6058
</Flex>
6159
</Flex>
6260
</Link>

apps/landing/src/components/Footer.tsx

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Box, css, Flex, Image, Text, VStack } from '@devup-ui/react'
22
import Link from 'next/link'
33

4-
import { URL_PREFIX } from '../constants'
5-
64
export function Footer() {
75
return (
86
<Box as="footer" bg="$footerBg" px="16px" py={['30px', '60px']}>
@@ -15,7 +13,7 @@ export function Footer() {
1513
<VStack flex="1" gap={[1, 0]}>
1614
<Link
1715
className={css({ textDecoration: 'none' })}
18-
href={URL_PREFIX + '/docs/overview'}
16+
href="/docs/overview"
1917
>
2018
<Text color="$footerTitle" typography="buttonS">
2119
Docs
@@ -24,7 +22,7 @@ export function Footer() {
2422
<VStack gap="14px">
2523
<Link
2624
className={css({ textDecoration: 'none' })}
27-
href={URL_PREFIX + '/docs/overview'}
25+
href="/docs/overview"
2826
>
2927
<Text color="$footerText" typography="footerMenu">
3028
Overview
@@ -33,31 +31,31 @@ export function Footer() {
3331

3432
<Link
3533
className={css({ textDecoration: 'none' })}
36-
href={URL_PREFIX + '/docs/installation'}
34+
href="/docs/installation"
3735
>
3836
<Text color="$footerText" typography="footerMenu">
3937
Installation
4038
</Text>
4139
</Link>
4240
<Link
4341
className={css({ textDecoration: 'none' })}
44-
href={URL_PREFIX + '/docs/features'}
42+
href="/docs/features"
4543
>
4644
<Text color="$footerText" typography="footerMenu">
4745
Features
4846
</Text>
4947
</Link>
5048
<Link
5149
className={css({ textDecoration: 'none' })}
52-
href={URL_PREFIX + '/docs/api/box'}
50+
href="/docs/api/box"
5351
>
5452
<Text color="$footerText" typography="footerMenu">
5553
API
5654
</Text>
5755
</Link>
5856
<Link
5957
className={css({ textDecoration: 'none' })}
60-
href={URL_PREFIX + '/docs/devup/devup-json'}
58+
href="/docs/devup/devup-json"
6159
>
6260
<Text color="$footerText" typography="footerMenu">
6361
Devup
@@ -66,10 +64,7 @@ export function Footer() {
6664
</VStack>
6765
</VStack>
6866
<VStack flex="1" gap="20px">
69-
<Link
70-
className={css({ textDecoration: 'none' })}
71-
href={URL_PREFIX + '/team'}
72-
>
67+
<Link className={css({ textDecoration: 'none' })} href="/team">
7368
<Text color="$footerTitle" typography="buttonS">
7469
Team
7570
</Text>
@@ -81,10 +76,10 @@ export function Footer() {
8176
flexDir={['column', 'row']}
8277
justifyContent="space-between"
8378
>
84-
<Link href={URL_PREFIX + '/'}>
79+
<Link href="/">
8580
<Image
8681
alt="white-logo"
87-
src={URL_PREFIX + '/white-logo.svg'}
82+
src="/white-logo.svg"
8883
w={['164px', '204px']}
8984
/>
9085
</Link>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import { Flex, Image, Input } from '@devup-ui/react'
22

3-
import { URL_PREFIX } from '../../constants'
4-
53
export function HeaderInput(props: React.ComponentProps<'input'>) {
64
return (
75
<Flex
@@ -12,7 +10,7 @@ export function HeaderInput(props: React.ComponentProps<'input'>) {
1210
p="8px 8px 6px"
1311
w="100%"
1412
>
15-
<Image boxSize="24px" src={URL_PREFIX + '/search.svg'} />
13+
<Image boxSize="24px" src="/search.svg" />
1614
<Input
1715
_placeholder={{
1816
color: '$caption',

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@
22
import { Text } from '@devup-ui/react'
33
import { usePathname } from 'next/navigation'
44

5-
import { URL_PREFIX } from '../../constants'
6-
75
interface MenuProps {
86
children?: React.ReactNode
97
keyword: string
108
}
119

1210
export function Menu({ children, keyword }: MenuProps) {
1311
const path = usePathname()
14-
const selected =
15-
path.startsWith(`${URL_PREFIX}/${keyword}`) ||
16-
path.startsWith(`/${keyword}`)
12+
const selected = path.startsWith(`/${keyword}`)
1713
return (
1814
<Text
1915
_active={{

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Box, css, Flex, Text } from '@devup-ui/react'
22
import Link from 'next/link'
33

44
import { LeftMenu } from '../../app/(detail)/docs/LeftMenu'
5-
import { URL_PREFIX } from '../../constants'
65
import { HeaderInput } from './HeaderInput'
76
import { HeaderInputWrap } from './HeaderInputWrap'
87
import { MobMenuWrap } from './MobMenuWrap'
@@ -20,7 +19,7 @@ export function MobMenu() {
2019
className={css({
2120
textDecoration: 'none',
2221
})}
23-
href={URL_PREFIX + '/docs/overview'}
22+
href="/docs/overview"
2423
>
2524
<Flex alignItems="center" py="10px">
2625
<Text color="$title" textAlign="right" typography="buttonM">
@@ -33,7 +32,7 @@ export function MobMenu() {
3332
className={css({
3433
textDecoration: 'none',
3534
})}
36-
href={URL_PREFIX + '/team'}
35+
href="/team"
3736
>
3837
<Flex alignItems="center" py="10px">
3938
<Text color="$title" textAlign="right" typography="buttonM">

0 commit comments

Comments
 (0)