-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
138 additions
and
0 deletions.
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
33 changes: 33 additions & 0 deletions
33
src/components/common/Button/pageBottom/pageBottomBtn.css.ts
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,33 @@ | ||
import theme from '@styles/theme.css'; | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
|
||
const bottomBtnStyle = recipe({ | ||
base: { | ||
...theme.FONTS.h5Sb16, | ||
color: theme.COLORS.white, | ||
borderRadius: 8, | ||
height: '5.2rem', | ||
}, | ||
variants: { | ||
size: { | ||
small: { | ||
width: '23.6rem', | ||
}, | ||
large: { | ||
width: '33.5rem', | ||
}, | ||
}, | ||
disabled: { | ||
true: { | ||
backgroundColor: theme.COLORS.gray5, | ||
cursor: 'not-allowed', | ||
}, | ||
false: { | ||
backgroundColor: theme.COLORS.primary400, | ||
cursor: 'pointer', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export default bottomBtnStyle; |
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,23 @@ | ||
import bottomBtnStyle from './pageBottomBtn.css'; | ||
|
||
interface PageBottomBtnProps { | ||
btnText: string; | ||
size: 'small' | 'large'; | ||
disabled: boolean; | ||
onClick: () => void; | ||
} | ||
|
||
const PageBottomBtn = ({ btnText, size, disabled, onClick }: PageBottomBtnProps) => { | ||
const className = bottomBtnStyle({ | ||
size, | ||
disabled, | ||
}); | ||
|
||
return ( | ||
<button className={className} onClick={disabled ? undefined : onClick}> | ||
{btnText} | ||
</button> | ||
); | ||
}; | ||
|
||
export default PageBottomBtn; |
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,79 @@ | ||
import PageBottomBtn from '@components/common/Button/pageBottom/pageBottomBtn'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
interface PageBottomBtnProps { | ||
btnText: string; | ||
size: 'small' | 'large'; | ||
disabled: boolean; | ||
onClick: () => void; | ||
} | ||
|
||
const meta: Meta<typeof PageBottomBtn> = { | ||
title: 'Common/PageBottomBtn', // 스토리북에서 표시될 경로 | ||
component: PageBottomBtn, | ||
parameters: { | ||
layout: 'centered', // 컴포넌트를 가운데 정렬 | ||
}, | ||
argTypes: { | ||
btnText: { | ||
control: { type: 'text' }, | ||
description: 'The text displayed on the button', | ||
}, | ||
size: { | ||
control: { type: 'select' }, | ||
options: ['small', 'large'], | ||
description: 'The size of the button', | ||
}, | ||
disabled: { | ||
control: { type: 'boolean' }, | ||
description: 'Indicates whether the button is disabled', | ||
}, | ||
onClick: { | ||
action: 'clicked', | ||
description: 'The function triggered when the button is clicked', | ||
}, | ||
}, | ||
args: { | ||
btnText: 'Click Me', | ||
size: 'large', | ||
disabled: false, | ||
}, | ||
}; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<PageBottomBtnProps>; | ||
|
||
export const Default: Story = {}; | ||
|
||
export const LargeEnabled: Story = { | ||
args: { | ||
btnText: '절로가 시작하기', | ||
size: 'large', | ||
disabled: false, | ||
}, | ||
}; | ||
|
||
export const SmallEnabled: Story = { | ||
args: { | ||
btnText: '예약하기', | ||
size: 'small', | ||
disabled: false, | ||
}, | ||
}; | ||
|
||
export const LargeDisabled: Story = { | ||
args: { | ||
btnText: '다음', | ||
size: 'large', | ||
disabled: true, | ||
}, | ||
}; | ||
|
||
export const SmallDisabled: Story = { | ||
args: { | ||
btnText: '예약하기', | ||
size: 'small', | ||
disabled: true, | ||
}, | ||
}; |