-
-
Notifications
You must be signed in to change notification settings - Fork 28
Feat landing #237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat landing #237
Changes from 19 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
6becdf7
Install clsx
forestream 368c34f
Update devup.json
forestream ab132a7
Merge branch 'main' into feat-landing
forestream 200013a
Publish button component mdx page
forestream 0b1494f
Fix button mdx page responsive design
forestream 3e40812
Fix hydration error
forestream 933d45f
Update snapshot
forestream 4b4824e
Fix HTML table error
forestream 00fbf1e
Fix table component structure
forestream 96870e7
Fix mdx texts
forestream 6e07e73
Add storybook link & fix routes
forestream 8a21052
Fix layout
forestream ff0be5f
Add icon
forestream ec6cd89
Fix header button keyword
forestream a3d90cf
Refactor mdx
forestream 80581a1
Fix button page layout
forestream 7413df3
Use mdx table
forestream ad5206b
Fix header responsive layout
forestream ea76ca7
Separate mdx local components
forestream d1dc5f6
Refactor
forestream 75fbf0b
Remove mdx comp
forestream 455ba52
Add padding to th, td
forestream 9c5b664
Refactor
forestream 1482a8e
Fix readmes
forestream bffa7dc
Fix react readme
forestream File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import { readFile } from 'node:fs/promises' | ||
| import { join } from 'node:path' | ||
|
|
||
| import { Box, css, VStack } from '@devup-ui/react' | ||
| import ReactMarkdown from 'react-markdown' | ||
|
|
||
| import { Code } from '@/components/Code' | ||
| import { _components } from '@/mdx-components' | ||
|
|
||
| import Card from './Card' | ||
| import MdxCardFooter from './MdxCardFooter' | ||
|
|
||
| export default async function MdxCard({ | ||
| src, | ||
| demo, | ||
| }: { | ||
| children: React.ReactNode | ||
| src: string | ||
| demo: React.ReactNode | ||
| }) { | ||
| const content = await readFile( | ||
| join( | ||
| process.cwd(), | ||
| 'src/app/(detail)/components', | ||
| src ?? 'button/demo/Variants.tsx', | ||
| ), | ||
| { | ||
| encoding: 'utf-8', | ||
| }, | ||
| ) | ||
| // extract comment | ||
| const comment = content.match(/\/\*\*[\s\S]*?\*\//)?.[0] | ||
| const code = content.replace('\n' + comment!, '') | ||
| const normalizedComment = comment | ||
| ?.replace(/\/\*\*|\*\//g, '') | ||
| ?.replace(/^\s*\*\s*/gm, '') | ||
|
|
||
| return ( | ||
| <Card | ||
| className={css({ | ||
| _active: { | ||
| transform: 'none', | ||
| }, | ||
| _hover: { | ||
| boxShadow: 'none', | ||
| }, | ||
| borderRadius: '10px', | ||
| border: '1px solid $border', | ||
| bg: '$containerBackground', | ||
| maxWidth: '100%', | ||
| flexShrink: 0, | ||
| cursor: 'default', | ||
| marginBottom: '20px', | ||
| _lastChild: { | ||
| marginBottom: '0', | ||
forestream marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| }, | ||
| typography: 'bodyReg', | ||
| color: '$text', | ||
| whiteSpace: 'pre-wrap', | ||
| })} | ||
| > | ||
| <VStack gap="30px" px="24px" py="32px"> | ||
| <Box>{demo}</Box> | ||
| <ReactMarkdown components={_components}> | ||
| {normalizedComment ?? ''} | ||
| </ReactMarkdown> | ||
| </VStack> | ||
| <MdxCardFooter> | ||
| <Code language="tsx" value={code} /> | ||
| </MdxCardFooter> | ||
| </Card> | ||
| ) | ||
| } | ||
57 changes: 57 additions & 0 deletions
57
apps/landing/src/app/(detail)/components/MdxCardFooter.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| 'use client' | ||
|
|
||
| import { Box, Center, Flex, Text, VStack } from '@devup-ui/react' | ||
| import { useState } from 'react' | ||
|
|
||
| import IconCode from '@/components/icons/IconCode' | ||
|
|
||
| export default function MdxCardFooter({ | ||
| children, | ||
| }: { | ||
| children: React.ReactNode | ||
| }) { | ||
| const [isOpen, setIsOpen] = useState(false) | ||
| return ( | ||
| <> | ||
forestream marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| <VStack justifyContent="flex-end" maxH="600px" maxW="100%"> | ||
| <Flex | ||
| borderTop="1px solid $border" | ||
| justifyContent="flex-end" | ||
| px="24px" | ||
| py="10px" | ||
| w="100%" | ||
| > | ||
| <Center | ||
| _active={{ | ||
| bg: '$menuActive', | ||
| }} | ||
| _hover={{ | ||
| bg: '$menuHover', | ||
| }} | ||
| borderRadius="4px" | ||
| color="$captionBold" | ||
| cursor="pointer" | ||
| gap="8px" | ||
| onClick={() => setIsOpen(!isOpen)} | ||
| p="8px" | ||
| transition="all 0.2s ease-in-out" | ||
| w="fit-content" | ||
| > | ||
| <IconCode isOpen={isOpen} /> | ||
| <Text>Show Code</Text> | ||
| </Center> | ||
| </Flex> | ||
| {isOpen && ( | ||
| <Box | ||
| borderTop="1px solid $border" | ||
| overflow="auto" | ||
| px="24px" | ||
| py="16px" | ||
| > | ||
| {children} | ||
| </Box> | ||
| )} | ||
| </VStack> | ||
| </> | ||
| ) | ||
| } | ||
forestream marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| import { Box } from '@devup-ui/react' | ||
|
|
||
| export function Table(props: React.ComponentProps<'table'>) { | ||
| return ( | ||
| <Box | ||
| as="table" | ||
| border="none" | ||
| selectors={{ | ||
| '& th, & td': { | ||
| border: 'none', | ||
| minWidth: '200px', | ||
| }, | ||
| }} | ||
forestream marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| styleOrder={1} | ||
| {...props} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| export function Tr(props: React.ComponentProps<'tr'>) { | ||
| return ( | ||
| <Box | ||
| as="tr" | ||
| borderBottom="1px solid $border" | ||
| borderTop="1px solid $border" | ||
| {...props} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| export function Td(props: React.ComponentProps<'td'>) { | ||
| return ( | ||
| <Box | ||
| as="td" | ||
| border="none" | ||
| px="20px" | ||
| py="14px" | ||
| styleOrder={1} | ||
| width="fit-content" | ||
| {...props} | ||
| /> | ||
| ) | ||
| } | ||
|
|
||
| export function Th(props: React.ComponentProps<'th'>) { | ||
| return ( | ||
| <Box | ||
| as="th" | ||
| bg="$cardBg" | ||
| border="none" | ||
| borderBottom="1px solid $border" | ||
| borderTop="1px solid $border" | ||
| color="$captionBold" | ||
| px="20px" | ||
| py="14px" | ||
| styleOrder={1} | ||
| textAlign="left" | ||
| typography="bodyBold" | ||
| {...props} | ||
| /> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ###### API | ||
| `Button` props extends the button HTML attributes. | ||
|
|
||
| <div style={{ width: '100%', overflow: 'auto'}}> | ||
| | Property | Description | Type | Default | | ||
| | --- | --- | --- | --- | | ||
| | **variant** | The variant of the button | `'primary' \| 'default'` | `'default'` | | ||
| | **colors** | The color variables of the button, i.e. `var(--primary)` | ```{<br> primary?: string<br> error?: string<br> text?: string<br> border?: string<br> inputBackground?: string<br> primaryFocus?: string<br>}``` | `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` | | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| **Button** | ||
|
|
||
| #### Button | ||
|
|
||
| `Button` component is used to handle user interactions. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.