diff --git a/apps/landing/src/app/(detail)/components/[component]/page.tsx b/apps/landing/src/app/(detail)/components/[component]/page.tsx index a0e41579..c7b074db 100644 --- a/apps/landing/src/app/(detail)/components/[component]/page.tsx +++ b/apps/landing/src/app/(detail)/components/[component]/page.tsx @@ -6,6 +6,7 @@ import { CustomH6 } from '@/components/mdx/components/CustomH6' import { CustomParagraph } from '@/components/mdx/components/CustomParagraph' import { CustomPre } from '@/components/mdx/components/CustomPre' import { CustomStrong } from '@/components/mdx/components/CustomStrong' +import { COMPONENT_GROUPS } from '@/constants' import { getDemos } from '@/utils/get-demos' import MdxCard from '../MdxCard' @@ -37,35 +38,11 @@ export const generateMetadata = async ({ } export const generateStaticParams = async () => { - return [ - 'button', - 'input', - 'uploader', - 'toggle', - 'tooltip', - 'textarea', - 'textbox', - 'theme-button', - 'snackbar', - 'stepper', - 'tab', - 'search', - 'select', - 'slider', - 'pagination', - 'progress-bar', - 'radio', - 'header', - 'label', - 'menu', - 'dropdown', - 'footer', - 'color-picker', - 'confirm', - 'date-picker', - 'checkbox', - 'bottom-sheet', - ].map((component) => ({ component })) + return Object.values(COMPONENT_GROUPS) + .flat() + .map((component) => ({ + component, + })) } export default async function Page({ diff --git a/apps/landing/src/app/(detail)/components/overview/page.tsx b/apps/landing/src/app/(detail)/components/overview/page.tsx index 488d27bf..4925b571 100644 --- a/apps/landing/src/app/(detail)/components/overview/page.tsx +++ b/apps/landing/src/app/(detail)/components/overview/page.tsx @@ -1,7 +1,8 @@ import { Center, css, Flex, Grid, Text, VStack } from '@devup-ui/react' import Link from 'next/link' -import * as Icons from '@/components/icons/components' +import { Icons } from '@/components/icons/components' +import { COMPONENT_GROUPS } from '@/constants' import Card from '../Card' @@ -33,363 +34,49 @@ export default function Page() { 'repeat(5, 1fr)', ]} > - - -
- -
- - - Button - - -
- - - -
- -
- - - Text box - - -
- - - -
- -
- - - Text area - - -
- - - -
- -
- - - Dropdown - - -
- - - -
- -
- - - Radio - - -
- - - -
- -
- - - Checkbox - - -
- - - -
- -
- - - Stepper - - -
- - - -
- -
- - - Toggle - - -
- - - -
- -
- - - Slider - - -
- - - -
- -
- - - Date picker - - -
- - - -
- -
- - - Color picker - - -
- - - -
- -
- - - Uploader - - -
- - - -
- -
- - - Pagination - - -
- - - -
- -
- - - Progress bar - - -
- - - -
- -
- - - Search - - -
- - - -
- -
- - - Select - - -
- - - -
- -
- - - Label - - -
- + {COMPONENT_GROUPS.Form.map((component) => { + const Icon = + Icons[ + `Icon${component + .split('-') + .map((item) => item.charAt(0).toUpperCase() + item.slice(1)) + .join('')}Comp` + ] + return ( + + +
+ +
+ + + {component + .split('-') + .map( + (item) => + item.charAt(0).toUpperCase() + item.slice(1), + ) + .join(' ')} + + +
+ + ) + })} @@ -407,174 +94,49 @@ export default function Page() { ]} overflow="visible" > - - -
- -
- - - Footer - - -
- - - -
- -
- - - Tooltip - - -
- - - -
- -
- - - Tab - - -
- - - -
- -
- - - Menu - - -
- - - -
- -
- - - Header - - -
- - - -
- -
- - - Confirm - - -
- - - -
- -
- - - Snackbar - - -
- - - -
- -
- - - Bottom sheet - - -
- + {COMPONENT_GROUPS.Layout.map((component) => { + const Icon = + Icons[ + `Icon${component + .split('-') + .map((item) => item.charAt(0).toUpperCase() + item.slice(1)) + .join('')}Comp` + ] + return ( + + +
+ +
+ + + {component + .split('-') + .map( + (item) => + item.charAt(0).toUpperCase() + item.slice(1), + ) + .join(' ')} + + +
+ + ) + })}
@@ -592,27 +154,49 @@ export default function Page() { ]} overflow="visible" > - - -
- -
- - - Theme Button - - -
- + {COMPONENT_GROUPS.Theme.map((component) => { + const Icon = + Icons[ + `Icon${component + .split('-') + .map((item) => item.charAt(0).toUpperCase() + item.slice(1)) + .join('')}Comp` + ] + return ( + + +
+ +
+ + + {component + .split('-') + .map( + (item) => + item.charAt(0).toUpperCase() + item.slice(1), + ) + .join(' ')} + + +
+ + ) + })}
diff --git a/apps/landing/src/components/Header/MobMenu.tsx b/apps/landing/src/components/Header/MobMenu.tsx index 0189543e..32619e02 100644 --- a/apps/landing/src/components/Header/MobMenu.tsx +++ b/apps/landing/src/components/Header/MobMenu.tsx @@ -59,6 +59,7 @@ export function MobMenu() { textDecoration: 'none', })} href="/storybook/index.html" + prefetch={false} > diff --git a/apps/landing/src/components/Header/index.tsx b/apps/landing/src/components/Header/index.tsx index 9ffb3ad5..402721d2 100644 --- a/apps/landing/src/components/Header/index.tsx +++ b/apps/landing/src/components/Header/index.tsx @@ -126,6 +126,7 @@ export function Header() { alignItems: 'center', })} href="/storybook/index.html" + prefetch={false} role="group" > Storybook diff --git a/apps/landing/src/components/icons/components/IconButtonComponent.tsx b/apps/landing/src/components/icons/components/IconButtonComp.tsx similarity index 99% rename from apps/landing/src/components/icons/components/IconButtonComponent.tsx rename to apps/landing/src/components/icons/components/IconButtonComp.tsx index 7d0a2b62..3c554d16 100644 --- a/apps/landing/src/components/icons/components/IconButtonComponent.tsx +++ b/apps/landing/src/components/icons/components/IconButtonComp.tsx @@ -3,7 +3,7 @@ import { css, useTheme } from '@devup-ui/react' import { SVGProps } from 'react' -export default function IconButtonComponent({ +export default function IconButtonComp({ className, ...props }: SVGProps) { diff --git a/apps/landing/src/components/icons/components/IconPagination.tsx b/apps/landing/src/components/icons/components/IconPaginationComp.tsx similarity index 98% rename from apps/landing/src/components/icons/components/IconPagination.tsx rename to apps/landing/src/components/icons/components/IconPaginationComp.tsx index 6eca1f17..61c78dae 100644 --- a/apps/landing/src/components/icons/components/IconPagination.tsx +++ b/apps/landing/src/components/icons/components/IconPaginationComp.tsx @@ -3,7 +3,7 @@ import { css, useTheme } from '@devup-ui/react' import { SVGProps } from 'react' -export default function IconPagination({ +export default function IconPaginationComp({ className, ...props }: SVGProps) { diff --git a/apps/landing/src/components/icons/components/IconProgressBar.tsx b/apps/landing/src/components/icons/components/IconProgressBarComp.tsx similarity index 98% rename from apps/landing/src/components/icons/components/IconProgressBar.tsx rename to apps/landing/src/components/icons/components/IconProgressBarComp.tsx index cc8b98ec..ccf2f898 100644 --- a/apps/landing/src/components/icons/components/IconProgressBar.tsx +++ b/apps/landing/src/components/icons/components/IconProgressBarComp.tsx @@ -3,7 +3,7 @@ import { css, useTheme } from '@devup-ui/react' import { SVGProps } from 'react' -export default function IconProgressBar({ +export default function IconProgressBarComp({ className, ...props }: SVGProps) { diff --git a/apps/landing/src/components/icons/components/IconTextAreaComp.tsx b/apps/landing/src/components/icons/components/IconTextareaComp.tsx similarity index 99% rename from apps/landing/src/components/icons/components/IconTextAreaComp.tsx rename to apps/landing/src/components/icons/components/IconTextareaComp.tsx index 5eb28586..6dd4f274 100644 --- a/apps/landing/src/components/icons/components/IconTextAreaComp.tsx +++ b/apps/landing/src/components/icons/components/IconTextareaComp.tsx @@ -3,7 +3,7 @@ import { useTheme } from '@devup-ui/react' import { SVGProps } from 'react' -export default function IconTextAreaComp({ +export default function IconTextareaComp({ className, ...props }: { diff --git a/apps/landing/src/components/icons/components/IconTextBoxComp.tsx b/apps/landing/src/components/icons/components/IconTextboxComp.tsx similarity index 99% rename from apps/landing/src/components/icons/components/IconTextBoxComp.tsx rename to apps/landing/src/components/icons/components/IconTextboxComp.tsx index e7b9a6aa..c533b381 100644 --- a/apps/landing/src/components/icons/components/IconTextBoxComp.tsx +++ b/apps/landing/src/components/icons/components/IconTextboxComp.tsx @@ -3,7 +3,7 @@ import { css, useTheme } from '@devup-ui/react' import { SVGProps } from 'react' -export default function IconTextBoxComp({ +export default function IconTextboxComp({ className, ...props }: SVGProps) { diff --git a/apps/landing/src/components/icons/components/index.ts b/apps/landing/src/components/icons/components/index.ts index d49d60e1..68ef90d0 100644 --- a/apps/landing/src/components/icons/components/index.ts +++ b/apps/landing/src/components/icons/components/index.ts @@ -1,5 +1,7 @@ +import { SVGProps } from 'react' + import IconBottomSheetComp from '@/components/icons/components/IconBottomSheetComp' -import IconButtonComponent from '@/components/icons/components/IconButtonComponent' +import IconButtonComp from '@/components/icons/components/IconButtonComp' import IconCheckboxComp from '@/components/icons/components/IconCheckboxComp' import IconColorPickerComp from '@/components/icons/components/IconColorPickerComp' import IconConfirmComp from '@/components/icons/components/IconConfirmComp' @@ -9,8 +11,8 @@ import IconFooterComp from '@/components/icons/components/IconFooterComp' import IconHeaderComp from '@/components/icons/components/IconHeaderComp' import IconLabelComp from '@/components/icons/components/IconLabelComp' import IconMenuComp from '@/components/icons/components/IconMenuComp' -import IconPagination from '@/components/icons/components/IconPagination' -import IconProgressBar from '@/components/icons/components/IconProgressBar' +import IconPaginationComp from '@/components/icons/components/IconPaginationComp' +import IconProgressBarComp from '@/components/icons/components/IconProgressBarComp' import IconRadioComp from '@/components/icons/components/IconRadioComp' import IconSearchComp from '@/components/icons/components/IconSearchComp' import IconSelectComp from '@/components/icons/components/IconSelectComp' @@ -18,16 +20,19 @@ import IconSliderComp from '@/components/icons/components/IconSliderComp' import IconSnackbarComp from '@/components/icons/components/IconSnackbarComp' import IconStepperComp from '@/components/icons/components/IconStepperComp' import IconTabComp from '@/components/icons/components/IconTabComp' -import IconTextAreaComp from '@/components/icons/components/IconTextAreaComp' -import IconTextBoxComp from '@/components/icons/components/IconTextBoxComp' +import IconTextareaComp from '@/components/icons/components/IconTextareaComp' +import IconTextboxComp from '@/components/icons/components/IconTextboxComp' import IconThemeButtonComp from '@/components/icons/components/IconThemeButtonComp' import IconToggleComp from '@/components/icons/components/IconToggleComp' import IconTooltipComp from '@/components/icons/components/IconTooltipComp' import IconUploaderComp from '@/components/icons/components/IconUploaderComp' -export { +export const Icons: Record< + string, + React.ComponentType> +> = { IconBottomSheetComp, - IconButtonComponent, + IconButtonComp, IconCheckboxComp, IconColorPickerComp, IconConfirmComp, @@ -37,8 +42,8 @@ export { IconHeaderComp, IconLabelComp, IconMenuComp, - IconPagination, - IconProgressBar, + IconPaginationComp, + IconProgressBarComp, IconRadioComp, IconSearchComp, IconSelectComp, @@ -46,8 +51,8 @@ export { IconSnackbarComp, IconStepperComp, IconTabComp, - IconTextAreaComp, - IconTextBoxComp, + IconTextareaComp, + IconTextboxComp, IconThemeButtonComp, IconToggleComp, IconTooltipComp, diff --git a/apps/landing/src/constants/index.ts b/apps/landing/src/constants/index.ts new file mode 100644 index 00000000..b93c764b --- /dev/null +++ b/apps/landing/src/constants/index.ts @@ -0,0 +1,32 @@ +export const COMPONENT_GROUPS = { + Form: [ + 'button', + 'textbox', + 'textarea', + 'dropdown', + 'radio', + 'checkbox', + 'stepper', + 'toggle', + 'slider', + 'date-picker', + 'color-picker', + 'uploader', + 'pagination', + 'progress-bar', + 'search', + 'select', + 'label', + ], + Layout: [ + 'footer', + 'tooltip', + 'tab', + 'menu', + 'header', + 'confirm', + 'snackbar', + 'bottom-sheet', + ], + Theme: ['theme-button'], +}