Skip to content
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

docs: BoxButton, TextButton 컴포넌트 문서에 아이콘 관련 내용을 추가 #155

Merged
merged 6 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/components/BoxButton/BoxButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ import { BoxButton } from '@yourssu/design-system-react';

<Canvas of={BoxButtonStories.Width} withSource="none" />

### leftIcon / rightIcon

`leftIcon` 또는 `rightIcon` prop으로 원하는 아이콘을 삽입합니다.<br />
아이콘과 텍스트는 동일한 색상으로 스타일링되어 있으므로, 별도의 색상을 지정하지 말아 주세요.

```tsx
<BoxButton size="large" hierarchy="primary" leftIcon={<IcExternalLinkLine />}>
with leftIcon
</BoxButton>
```

<Canvas of={BoxButtonStories.WithIcon} withSource="none" />

### BoxButton 클릭 시 이벤트 할당

`onClick` 메서드를 이용하여 원하는 이벤트를 할당할 수 있습니다.
Expand Down
15 changes: 15 additions & 0 deletions src/components/BoxButton/BoxButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Meta, StoryObj } from '@storybook/react';

import { IcExternalLinkLine } from '@/style';

import { BoxButton } from './BoxButton';

const meta: Meta<typeof BoxButton> = {
Expand Down Expand Up @@ -101,3 +103,16 @@ export const Click: Story = {
},
},
};

export const WithIcon: Story = {
render: () => (
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<BoxButton size="large" hierarchy="primary" leftIcon={<IcExternalLinkLine />}>
with leftIcon
</BoxButton>
<BoxButton size="large" hierarchy="primary" disabled rightIcon={<IcExternalLinkLine />}>
with rightIcon
</BoxButton>
</div>
),
};
13 changes: 13 additions & 0 deletions src/components/TextButton/TextButton.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,19 @@ import { TextButton } from '@yourssu/design-system-react';

<Canvas of={TextButtonStories.Width} withSource="none" />

### leftIcon / rightIcon

`leftIcon` 또는 `rightIcon` prop으로 원하는 아이콘을 삽입합니다.<br />
아이콘과 텍스트는 동일한 색상으로 스타일링되어 있으므로, 별도의 색상을 지정하지 말아 주세요.

```tsx
<TextButton size="medium" hierarchy="primary" leftIcon={<IcExternalLinkLine />}>
with leftIcon
</TextButton>
```

<Canvas of={TextButtonStories.WithIcon} withSource="none" />

### TextButton 클릭 시 이벤트 할당

`onClick` 메서드를 이용하여 원하는 이벤트를 할당할 수 있습니다.
Expand Down
13 changes: 13 additions & 0 deletions src/components/TextButton/TextButton.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,16 @@ export const Click: Story = {
},
},
};

export const WithIcon: Story = {
render: () => (
<div style={{ display: 'flex', alignItems: 'center', gap: '12px' }}>
<TextButton size="medium" hierarchy="primary" leftIcon={<IcExternalLinkLine />}>
with leftIcon
</TextButton>
<TextButton size="medium" hierarchy="primary" disabled rightIcon={<IcExternalLinkLine />}>
with rightIcon
</TextButton>
</div>
),
};
Loading