-
Notifications
You must be signed in to change notification settings - Fork 1
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
[FEAT] ButtonBar 컴포넌트 퍼블리싱 #79
Open
seong-hui
wants to merge
8
commits into
develop
Choose a base branch
from
feat/#77/button-bar
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4500ca4
fix: TextBtn size에 따라 style수정 코드 추가
seong-hui c31e105
feat: flowerBtn 컴포넌트 퍼블리싱
seong-hui ecf7387
fix: pageBottomBtn isDisabled 속성 optional로 수정
seong-hui 8c44a4b
feat: ButtonBar 컴포넌트 구현
seong-hui 5dbc8aa
test: ButtonBar storybook 추가
seong-hui 7719250
fix: ButtonBar label props로 받는 형식으로 수정
seong-hui 2b4713b
fix: TextBtn medium사이즈일때 active 효과 수정
seong-hui cc1908e
Merge branch 'develop' into feat/#77/button-bar
seong-hui 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,40 @@ | ||
import buttonBarContainer from '@components/common/button/buttonBar/buttonBar.css'; | ||
import FlowerBtn from '@components/common/button/flowerBtn/FlowerBtn'; | ||
import PageBottomBtn from '@components/common/button/pageBottom/PageBottomBtn'; | ||
import TextBtn from '@components/common/button/textBtn/TextBtn'; | ||
import { useState } from 'react'; | ||
|
||
interface ButtonBarProps { | ||
type: 'reset' | 'wish'; | ||
label: string; | ||
} | ||
|
||
const ButtonBar = ({ type, label }: ButtonBarProps) => { | ||
const [isActive, setIsActive] = useState(false); | ||
|
||
const onClickLefthBtn = () => { | ||
setIsActive((prev) => !prev); | ||
}; | ||
|
||
const renderLeftButton = () => | ||
type === 'wish' ? ( | ||
<FlowerBtn label="찜하기" isActive={isActive} isLeftIcn onClick={onClickLefthBtn} /> | ||
) : ( | ||
<TextBtn | ||
text="초기화" | ||
onClick={onClickLefthBtn} | ||
leftIcon="IcnReset" | ||
size="medium" | ||
clicked={isActive} | ||
/> | ||
); | ||
|
||
return ( | ||
<div className={buttonBarContainer}> | ||
{renderLeftButton()} | ||
<PageBottomBtn btnText={label} size="small" onClick={() => {}} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ButtonBar; |
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,15 @@ | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
const buttonBarContainer = style({ | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
width: '37.5rem', | ||
height: '7.2rem', | ||
padding: '1rem 2rem', | ||
boxSizing: 'border-box', | ||
|
||
boxShadow: `0px -4px 16px 0px rgba(0, 0, 0, 0.05)`, | ||
}); | ||
|
||
export default buttonBarContainer; |
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 FlowerIcon from '@components/common/icon/FlowerIcon'; | ||
|
||
import * as styles from './flowerBtn.css'; | ||
|
||
interface FlowerBtnProps { | ||
isRightIcn?: boolean; | ||
isLeftIcn?: boolean; | ||
label: string; | ||
isActive: boolean; | ||
onClick: () => void; | ||
} | ||
|
||
const FlowerBtn = ({ | ||
isRightIcn = false, | ||
isLeftIcn = false, | ||
label, | ||
isActive, | ||
onClick, | ||
}: FlowerBtnProps) => { | ||
return ( | ||
<button className={styles.FlowerBtnStyle} onClick={onClick}> | ||
{isLeftIcn && <FlowerIcon isActive={isActive} />} | ||
<p className={styles.textStyle({ active: isActive ? true : false })}>{label}</p> | ||
{isRightIcn && <FlowerIcon isActive={isActive} />} | ||
</button> | ||
); | ||
}; | ||
|
||
export default FlowerBtn; |
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,30 @@ | ||
import theme from '@styles/theme.css'; | ||
import { style } from '@vanilla-extract/css'; | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
|
||
export const FlowerBtnStyle = style({ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
height: '4.4rem', | ||
gap: '0.3rem', | ||
|
||
padding: '0 0.3rem', | ||
boxSizing: 'border-box', | ||
}); | ||
|
||
export const textStyle = recipe({ | ||
base: { | ||
...theme.FONTS.b8M15, | ||
color: theme.COLORS.gray7, | ||
}, | ||
|
||
variants: { | ||
active: { | ||
false: {}, | ||
true: { | ||
color: theme.COLORS.gray10, | ||
}, | ||
}, | ||
}, | ||
}); |
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
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
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 |
---|---|---|
@@ -1,35 +1,64 @@ | ||
import theme from '@styles/theme.css'; | ||
import { style } from '@vanilla-extract/css'; | ||
import { recipe } from '@vanilla-extract/recipes'; | ||
|
||
export const iconStyle = style({ | ||
width: '1.3rem', | ||
height: '1.3rem', | ||
color: 'currentColor', | ||
export const iconStyle = recipe({ | ||
base: { | ||
color: 'currentColor', | ||
}, | ||
variants: { | ||
size: { | ||
small: { | ||
width: '1.3rem', | ||
height: '1.3rem', | ||
}, | ||
medium: { | ||
width: '2rem', | ||
height: '2rem', | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
const textBtnStyle = recipe({ | ||
export const textBtnStyle = recipe({ | ||
base: { | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
gap: '0.3rem', | ||
...theme.FONTS.c6R13, | ||
color: theme.COLORS.gray5, | ||
}, | ||
|
||
variants: { | ||
clicked: { | ||
false: {}, | ||
true: { | ||
color: theme.COLORS.gray9, | ||
}, | ||
true: {}, | ||
}, | ||
|
||
size: { | ||
small: { height: '3.3rem' }, | ||
medium: { height: '4.4rem' }, | ||
small: { height: '3.3rem', color: theme.COLORS.gray5, ...theme.FONTS.c6R13 }, | ||
medium: { | ||
height: '4.4rem', | ||
color: theme.COLORS.gray7, | ||
padding: '0 0.8rem', | ||
...theme.FONTS.b8M15, | ||
selectors: { | ||
'&:active': { | ||
color: theme.COLORS.gray10, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
export default textBtnStyle; | ||
compoundVariants: [ | ||
{ | ||
variants: { | ||
clicked: true, | ||
size: 'small', | ||
}, | ||
style: { | ||
color: theme.COLORS.gray9, | ||
}, | ||
}, | ||
], | ||
}); |
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,11 @@ | ||
import Icon from '@assets/svgs'; | ||
|
||
interface FlowerIconProps { | ||
isActive?: boolean; | ||
} | ||
|
||
const FlowerIcon = ({ isActive = false }: FlowerIconProps) => { | ||
return <>{isActive ? <Icon.IcnFlowerPink /> : <Icon.IcnFlowerGray />}</>; | ||
}; | ||
|
||
export default FlowerIcon; |
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,27 @@ | ||
import ButtonBar from '@components/common/button/buttonBar/ButtonBar'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta = { | ||
title: 'Common/Button/ButtonBar', | ||
component: ButtonBar, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
type: { | ||
control: { type: 'select' }, | ||
options: ['reset', 'wish'], | ||
}, | ||
}, | ||
args: { | ||
type: 'wish', | ||
label: '예약하기', | ||
}, | ||
} satisfies Meta<typeof ButtonBar>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; |
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,38 @@ | ||
import FlowerBtn from '@components/common/button/flowerBtn/FlowerBtn'; | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
const meta = { | ||
title: 'Common/Button/FlowerBtn', | ||
component: FlowerBtn, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
argTypes: { | ||
label: { | ||
control: { type: 'text' }, | ||
}, | ||
isRightIcn: { | ||
control: { type: 'boolean' }, | ||
}, | ||
isLeftIcn: { | ||
control: { type: 'boolean' }, | ||
}, | ||
isActive: { | ||
control: { type: 'boolean' }, | ||
}, | ||
}, | ||
args: { | ||
label: '찜하기', | ||
isRightIcn: true, | ||
isLeftIcn: true, | ||
isActive: false, | ||
onClick: () => {}, | ||
}, | ||
} satisfies Meta<typeof FlowerBtn>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해당 파일에 초기화 버튼 클릭시에 색이 어두워지도록 적용하면 좋을 것 같아요!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reset버튼일 경우에는
&:active
해당 효과 추가해서 클릭할때마다 텍스트 색상이 변경될 수 있도록 수정하였습니다! 해당 부분에 대해서 생각하지 못했었는데 좋은 리뷰 감사합니다