From ef8e63eb529586054bfa0b1f6b1bfe01a9db4c0e Mon Sep 17 00:00:00 2001 From: owjs3901 Date: Mon, 9 Jun 2025 17:54:35 +0900 Subject: [PATCH] Refactor landing --- .../src/app/(detail)/docs/MenuItem.tsx | 11 +++------ .../src/app/(detail)/docs/OpenMenuItem.tsx | 13 ++++------- apps/landing/src/app/FeatureCard.tsx | 4 +--- apps/landing/src/app/layout.tsx | 23 ++++++++++++++++--- apps/landing/src/app/page.tsx | 12 ++++------ apps/landing/src/components/Discord.tsx | 6 ++--- apps/landing/src/components/Footer.tsx | 23 ++++++++----------- .../src/components/Header/HeaderInput.tsx | 4 +--- apps/landing/src/components/Header/Menu.tsx | 6 +---- .../landing/src/components/Header/MobMenu.tsx | 5 ++-- apps/landing/src/components/Header/index.tsx | 11 ++++----- apps/landing/src/components/Logo.tsx | 3 +-- .../components/SearchModal/SearchContent.tsx | 4 +--- apps/landing/src/constants.ts | 2 -- apps/landing/src/utils/is-root.ts | 4 +--- 15 files changed, 55 insertions(+), 76 deletions(-) delete mode 100644 apps/landing/src/constants.ts diff --git a/apps/landing/src/app/(detail)/docs/MenuItem.tsx b/apps/landing/src/app/(detail)/docs/MenuItem.tsx index 66170220..2bd3e84d 100644 --- a/apps/landing/src/app/(detail)/docs/MenuItem.tsx +++ b/apps/landing/src/app/(detail)/docs/MenuItem.tsx @@ -3,7 +3,6 @@ import { Box, css, Flex, Text } from '@devup-ui/react' import Link from 'next/link' import { usePathname } from 'next/navigation' -import { URL_PREFIX } from '../../../constants' import { OpenMenuItem } from './OpenMenuItem' export interface MenuItemProps { @@ -19,12 +18,8 @@ export function MenuItem(props: MenuItemProps) { const { children, to, subMenu } = props const path = usePathname() const selected = to - ? path.startsWith(to) || path.startsWith(URL_PREFIX + to) - : !!subMenu?.some((item) => - item.to - ? path.startsWith(URL_PREFIX + item.to) || path.startsWith(item.to) - : false, - ) + ? path.startsWith(to) + : !!subMenu?.some((item) => (item.to ? path.startsWith(item.to) : false)) if (subMenu) return const inner = ( @@ -61,7 +56,7 @@ export function MenuItem(props: MenuItemProps) { className={css({ textDecoration: 'none', })} - href={URL_PREFIX + to} + href={to} > {inner} diff --git a/apps/landing/src/app/(detail)/docs/OpenMenuItem.tsx b/apps/landing/src/app/(detail)/docs/OpenMenuItem.tsx index ad0d215a..0f186488 100644 --- a/apps/landing/src/app/(detail)/docs/OpenMenuItem.tsx +++ b/apps/landing/src/app/(detail)/docs/OpenMenuItem.tsx @@ -4,7 +4,6 @@ import Link from 'next/link' import { usePathname } from 'next/navigation' import { Fragment, useReducer } from 'react' -import { URL_PREFIX } from '../../../constants' import { MenuItemProps } from './MenuItem' export function OpenMenuItem({ @@ -14,9 +13,7 @@ export function OpenMenuItem({ Required>) { const path = usePathname() const selected = subMenu.some((item) => - item.to - ? path.startsWith(URL_PREFIX + item.to) || path.startsWith(item.to) - : false, + item.to ? path.startsWith(item.to) : false, ) const [open, handleOpen] = useReducer((state) => !state, selected) return ( @@ -45,7 +42,7 @@ export function OpenMenuItem({ {subMenu && ( @@ -56,9 +53,7 @@ export function OpenMenuItem({ {subMenu.map(({ children, to }, idx) => { - const selected = to - ? path.startsWith(to) || path.startsWith(URL_PREFIX + to) - : false + const selected = to ? path.startsWith(to) : false const inner = ( {inner} diff --git a/apps/landing/src/app/FeatureCard.tsx b/apps/landing/src/app/FeatureCard.tsx index ed0a21e6..bc39d945 100644 --- a/apps/landing/src/app/FeatureCard.tsx +++ b/apps/landing/src/app/FeatureCard.tsx @@ -1,7 +1,5 @@ import { Flex, Image, Text, VStack } from '@devup-ui/react' -import { URL_PREFIX } from '../constants' - interface FeatureCardProps { title: string description: string @@ -12,7 +10,7 @@ export function FeatureCard({ icon, description, title }: FeatureCardProps) { return ( - + diff --git a/apps/landing/src/app/layout.tsx b/apps/landing/src/app/layout.tsx index 9e9a3f0f..af2272a8 100644 --- a/apps/landing/src/app/layout.tsx +++ b/apps/landing/src/app/layout.tsx @@ -7,7 +7,6 @@ import type { Metadata } from 'next' import { Footer } from '../components/Footer' import { Header } from '../components/Header' import { SearchModal } from '../components/SearchModal' -import { URL_PREFIX } from '../constants' export const metadata: Metadata = { title: 'Devup UI', @@ -22,10 +21,20 @@ export default function RootLayout({ return ( + +`, + }} + /> - {URL_PREFIX && } - + +