-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(primitives): add storybook documentation (#2094)
<!-- How to write a good PR title: - Follow [the Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/). - Give as much context as necessary and as little as possible - Prefix it with [WIP] while it’s a work in progress --> ## Self Checklist - [x] I wrote a PR title in **English** and added an appropriate **label** to the PR. - [x] I wrote the commit message in **English** and to follow [**the Conventional Commits specification**](https://www.conventionalcommits.org/en/v1.0.0/). - [x] I [added the **changeset**](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md) about the changes that needed to be released. (or didn't have to) - [x] I wrote or updated **documentation** related to the changes. (or didn't have to) - [x] I wrote or updated **tests** related to the changes. (or didn't have to) - [x] I tested the changes in various browsers. (or didn't have to) - Windows: Chrome, Edge, (Optional) Firefox - macOS: Chrome, Edge, Safari, (Optional) Firefox ## Summary <!-- Please brief explanation of the changes made --> Dialog/TooltipPrimitive의 스토리북 문서를 추가합니다. ## Details <!-- Please elaborate description of the changes --> - 스토리북에 primitive 컴포넌트를 추가해서 다른 팀원들이 컴포넌트의 존재를 알 수 있도록 했습니다. - 컴포넌트명이 radix-ui와 완벽하게 동일하지는 않기 때문에, 사용자의 이해를 돕고자 mdx를 사용, Anatomy 항목을 추가했습니다. - 스토리북 전체: stories.mdx -> .mdx 로 일괄 변경했습니다. ### Breaking change? (Yes/No) <!-- If Yes, please describe the impact and migration path for users --> No
- Loading branch information
1 parent
d5f85e2
commit 67d6f4b
Showing
7 changed files
with
152 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
29 changes: 29 additions & 0 deletions
29
packages/bezier-react/src/alpha-components/DialogPrimitive/DialogPrimitive.mdx
This file contains 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,29 @@ | ||
import { Canvas, Meta } from '@storybook/blocks' | ||
|
||
import * as DialogPrimitive from './DialogPrimitive.stories' | ||
|
||
<Meta of={DialogPrimitive} /> | ||
|
||
# DialogPrimitive | ||
|
||
`DialogPrimitive` is wrapper component for the radix-ui `Dialog` component. For more information, see [radix-ui documentation](https://www.radix-ui.com/primitives/docs/components/dialog). | ||
|
||
<Canvas of={DialogPrimitive.Primary} /> | ||
|
||
## Anatomy | ||
|
||
`DialogPrimitive` is a composition of several components: | ||
|
||
```tsx | ||
<DialogPrimitive> | ||
<DialogPrimitiveTrigger /> | ||
<DialogPrimitivePortal> | ||
<DialogPrimitiveOverlay /> | ||
<DialogPrimitiveContent> | ||
<DialogPrimitiveTitle /> | ||
<DialogPrimitiveDescription /> | ||
<DialogPrimitiveClose /> | ||
</DialogPrimitiveContent> | ||
</DialogPrimitivePortal> | ||
</DialogPrimitive> | ||
``` |
54 changes: 54 additions & 0 deletions
54
packages/bezier-react/src/alpha-components/DialogPrimitive/DialogPrimitive.stories.tsx
This file contains 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,54 @@ | ||
import React from 'react' | ||
|
||
import { | ||
type Meta, | ||
type StoryObj, | ||
} from '@storybook/react' | ||
|
||
import { | ||
DialogPrimitive, | ||
DialogPrimitiveClose, | ||
DialogPrimitiveContent, | ||
DialogPrimitiveDescription, | ||
DialogPrimitiveOverlay, | ||
DialogPrimitivePortal, | ||
DialogPrimitiveTitle, | ||
DialogPrimitiveTrigger, | ||
} from './DialogPrimitive' | ||
|
||
function DialogComposition() { | ||
return ( | ||
<DialogPrimitive> | ||
<DialogPrimitiveTrigger>Trigger</DialogPrimitiveTrigger> | ||
<DialogPrimitivePortal> | ||
<DialogPrimitiveOverlay style={{ | ||
position: 'fixed', | ||
inset: 0, | ||
backgroundColor: 'rgba(0, 0, 0, 0.5)', | ||
}} | ||
/> | ||
<DialogPrimitiveContent style={{ | ||
position: 'fixed', | ||
top: '50%', | ||
left: '50%', | ||
transform: 'translate(-50%, -50%)', | ||
backgroundColor: 'white', | ||
}} | ||
> | ||
<DialogPrimitiveTitle>Title</DialogPrimitiveTitle> | ||
<DialogPrimitiveDescription>Description</DialogPrimitiveDescription> | ||
<div>Content</div> | ||
<DialogPrimitiveClose>Close</DialogPrimitiveClose> | ||
</DialogPrimitiveContent> | ||
</DialogPrimitivePortal> | ||
</DialogPrimitive> | ||
) | ||
} | ||
|
||
const meta: Meta<typeof DialogComposition> = { | ||
component: DialogComposition, | ||
} | ||
|
||
export const Primary: StoryObj = {} | ||
|
||
export default meta |
28 changes: 28 additions & 0 deletions
28
packages/bezier-react/src/alpha-components/TooltipPrimitive/TooltipPrimitive.mdx
This file contains 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,28 @@ | ||
import { Canvas, Meta } from '@storybook/blocks' | ||
|
||
import * as TooltipPrimitive from './TooltipPrimitive.stories' | ||
|
||
<Meta of={TooltipPrimitive} /> | ||
|
||
# TooltipPrimitive | ||
|
||
`TooltipPrimitive` is wrapper component for the radix-ui `Tooltip` component. For more information, see [radix-ui documentation](https://www.radix-ui.com/primitives/docs/components/tooltip). | ||
|
||
<Canvas of={TooltipPrimitive.Primary} /> | ||
|
||
## Anatomy | ||
|
||
`TooltipPrimitive` is a composition of several components: | ||
|
||
```tsx | ||
<TooltipPrimitiveProvider> | ||
<TooltipPrimitive> | ||
<TooltipPrimitiveTrigger /> | ||
<TooltipPrimitivePortal> | ||
<TooltipPrimitiveContent> | ||
<TooltipPrimitiveArrow /> | ||
</TooltipPrimitiveContent> | ||
</TooltipPrimitivePortal> | ||
</TooltipPrimitive> | ||
</TooltipPrimitiveProvider> | ||
``` |
39 changes: 39 additions & 0 deletions
39
packages/bezier-react/src/alpha-components/TooltipPrimitive/TooltipPrimitive.stories.tsx
This file contains 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,39 @@ | ||
import React from 'react' | ||
|
||
import { | ||
type Meta, | ||
type StoryObj, | ||
} from '@storybook/react' | ||
|
||
import { | ||
TooltipPrimitive, | ||
TooltipPrimitiveArrow, | ||
TooltipPrimitiveContent, | ||
TooltipPrimitivePortal, | ||
TooltipPrimitiveProvider, | ||
TooltipPrimitiveTrigger, | ||
} from './TooltipPrimitive' | ||
|
||
function TooltipComposition() { | ||
return ( | ||
<TooltipPrimitiveProvider> | ||
<TooltipPrimitive> | ||
<TooltipPrimitiveTrigger>Trigger</TooltipPrimitiveTrigger> | ||
<TooltipPrimitivePortal> | ||
<TooltipPrimitiveContent> | ||
Content | ||
<TooltipPrimitiveArrow /> | ||
</TooltipPrimitiveContent> | ||
</TooltipPrimitivePortal> | ||
</TooltipPrimitive> | ||
</TooltipPrimitiveProvider> | ||
) | ||
} | ||
|
||
const meta: Meta<typeof TooltipComposition> = { | ||
component: TooltipComposition, | ||
} | ||
|
||
export const Primary: StoryObj = {} | ||
|
||
export default meta |
File renamed without changes.
File renamed without changes.