diff --git a/apps/landing/src/app/(detail)/components/[component]/button/Api.mdx b/apps/landing/src/app/(detail)/components/[component]/button/Api.mdx index c3d0a455..92d987cb 100644 --- a/apps/landing/src/app/(detail)/components/[component]/button/Api.mdx +++ b/apps/landing/src/app/(detail)/components/[component]/button/Api.mdx @@ -1,14 +1,48 @@ +import { PropsTable } from '@/components/PropsTable' + ###### API `Button` props extends the button HTML attributes. -
-| Property | Description | Type | Default | -| --- | --- | --- | --- | -| **variant** | The variant of the button | `'primary' \| 'default'` | `'default'` | -| **colors** | The color variables of the button, i.e. `var(--primary)` | ```{
primary?: string
error?: string
text?: string
border?: string
inputBackground?: string
primaryFocus?: string
}``` | `undefined` | -| **danger** | Signals that it should be used with caution. It is often used in a delete button or to show the error status. | `boolean` | `false` | -| **size** | The size of the button | `'sm' \| 'md' \| 'lg'` | `'md'` | -| **icon** | Icon of the button passed in as a form of ReactNode | `React.ReactNode` | `undefined` | -| **ellipsis** | Whether the button text should be truncated with an ellipsis. The button should have a width to be able to truncate the text. | `boolean` | `false` | -
+ primary?: string
error?: string
text?: string
border?: string
inputBackground?: string
primaryFocus?: string
}```', + default: '`undefined`', + }, + { + property: 'danger', + description: + 'Signals that it should be used with caution. It is often used in a delete button or to show the error status.', + type: '`boolean`', + default: '`false`', + }, + { + property: 'size', + description: 'The size of the button', + type: "`'sm' | 'md' | 'lg'`", + default: "`'md'`", + }, + { + property: 'icon', + description: 'Icon of the button passed in as a form of ReactNode', + type: '`React.ReactNode`', + default: '`undefined`', + }, + { + property: 'ellipsis', + description: + 'Whether the button text should be truncated with an ellipsis. The button should have a width to be able to truncate the text.', + type: '`boolean`', + default: '`false`', + }, + ]} +/> diff --git a/apps/landing/src/app/(detail)/components/[component]/page.tsx b/apps/landing/src/app/(detail)/components/[component]/page.tsx index c7b074db..3a8fd6d4 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 { PropsTable } from '@/components/PropsTable' import { COMPONENT_GROUPS } from '@/constants' import { getDemos } from '@/utils/get-demos' @@ -102,6 +103,7 @@ export default async function Page({ h6: CustomH6, pre: CustomPre, p: CustomParagraph, + PropsTable, }} /> diff --git a/apps/landing/src/app/layout.tsx b/apps/landing/src/app/layout.tsx index 95b281fb..f11af852 100644 --- a/apps/landing/src/app/layout.tsx +++ b/apps/landing/src/app/layout.tsx @@ -27,18 +27,6 @@ export const metadata: Metadata = { resetCss() globalCss({ - table: { - borderCollapse: 'collapse', - borderSpacing: 0, - border: '1px solid var(--text)', - color: 'var(--text, #2F2F2F)', - fontFamily: 'Pretendard', - fontSize: '16px', - fontStyle: 'normal', - fontWeight: 400, - lineHeight: '150%', - letterSpacing: '-0.48px', - }, code: { fontFamily: 'D2Coding', fontSize: ['13px', '15px'], @@ -47,10 +35,6 @@ globalCss({ lineHeight: '1.5', letterSpacing: '-0.03em', }, - 'th, td': { - border: '1px solid var(--text)', - padding: '6px 13px', - }, pre: { borderRadius: '10px', }, @@ -117,7 +101,7 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= width="0" /> - +
diff --git a/apps/landing/src/components/PropsTable.tsx b/apps/landing/src/components/PropsTable.tsx new file mode 100644 index 00000000..0847e7f8 --- /dev/null +++ b/apps/landing/src/components/PropsTable.tsx @@ -0,0 +1,90 @@ +import { Text, VStack } from '@devup-ui/react' +import Markdown from 'react-markdown' + +import { _components } from '@/mdx-components' + +import { CustomCodeBlock } from './mdx/components/CustomCodeBlock' +import { + Table, + TableBody, + TableCell, + TableHead, + TableHeaderCell, + TableRow, +} from './mdx/components/Table' + +interface ComponentProp { + property: string + description?: string + type?: string + default?: string +} + +const MdxComponentsWithCodeBlock = ({ children }: { children?: string }) => { + return ( + + {children} + + ) +} + +interface PropTableProps { + componentProps: ComponentProp[] +} + +export const PropsTable = async (props: PropTableProps) => { + const { componentProps } = props + + return ( + + + + Prop + description + Type + Default + + + + {componentProps.length === 0 && ( + + + No props to display + + + )} + {componentProps.map( + ({ property, description, type, default: defaultValue }) => ( + + + {property} + + + + {description} + + + + + + {type?.replaceAll('"', "'")} + + + + + + {defaultValue} + + + + ), + )} + +
+ ) +} diff --git a/apps/landing/src/components/mdx/components/CustomCodeBlock.tsx b/apps/landing/src/components/mdx/components/CustomCodeBlock.tsx new file mode 100644 index 00000000..429ae342 --- /dev/null +++ b/apps/landing/src/components/mdx/components/CustomCodeBlock.tsx @@ -0,0 +1,21 @@ +import { Box, Text } from '@devup-ui/react' + +export function CustomCodeBlock({ children }: { children: string }) { + return ( + + {children.split('
').map((line, index) => ( + + {index > 0 &&
} + {line} +
+ ))} +
+ ) +} diff --git a/apps/landing/src/components/mdx/components/Table/index.tsx b/apps/landing/src/components/mdx/components/Table/index.tsx new file mode 100644 index 00000000..02c4155f --- /dev/null +++ b/apps/landing/src/components/mdx/components/Table/index.tsx @@ -0,0 +1,51 @@ +import { Box } from '@devup-ui/react' +import { type ComponentProps } from 'react' + +export const Table = ({ ...props }: ComponentProps<'table'>) => { + return ( + + + + ) +} + +export const TableBody = ({ ...props }: ComponentProps<'tbody'>) => { + return +} + +export const TableCell = ({ ...props }: ComponentProps<'th'>) => { + return +} + +export const TableHead = ({ ...props }: ComponentProps<'thead'>) => { + return ( + + ) +} + +export const TableHeaderCell = ({ ...props }: ComponentProps<'th'>) => { + return +} + +export const TableRow = ({ ...props }: ComponentProps<'tr'>) => { + return ( + + ) +}