-
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
[FIX] 버튼 컴포넌트 에러 / 로직 수정 & 새 버튼 구현 #58
Changes from 12 commits
d37f8c6
b906972
56668b6
c75ccae
323fe3f
0595267
775614d
933143d
b1d4f7f
e973467
4560969
b19d517
a7c72b4
f94de9e
cb382a2
26e6a8b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { css } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
import Icons from '@/assets/svg/index'; | ||
|
||
function DeleteBtn() { | ||
return ( | ||
<DeleteBtnLayout> | ||
<StlyedDeleteIcon /> | ||
</DeleteBtnLayout> | ||
); | ||
} | ||
|
||
export default DeleteBtn; | ||
|
||
const DeleteBtnCss = css` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 3.2rem; | ||
height: 3.2rem; | ||
|
||
border-radius: 10px; | ||
`; | ||
|
||
const DeleteBtnLayout = styled.button` | ||
${DeleteBtnCss} | ||
`; | ||
|
||
const StlyedDeleteIcon = styled(Icons.DeleteIcon)` | ||
width: 1.8rem; | ||
height: 1.8rem; | ||
`; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,29 @@ | ||
import styled from '@emotion/styled'; | ||
import { css } from '@emotion/react'; | ||
import styled from '@emotion/styled'; | ||
|
||
import Icons from '@/assets/svg/index'; | ||
|
||
interface Check1 { | ||
interface Check1Props { | ||
type: 'setting' | 'done'; | ||
isHover: boolean; | ||
isPressed: boolean; | ||
} | ||
|
||
const Check1Btn = ({ type }: Check1) => { | ||
function Check1Btn({ type, isHover, isPressed }: Check1Props) { | ||
return ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hover나 active의 상황도 props로 받는 과정으로 수정하셨군요! 혹시 해당 내용을 props로 받아서 관리해야 하는지 궁금합니다! There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 아하 이게 그 같은 버튼이라도 호버가 될 때가 있고 아닐때도 있다는 부분이었군요..! 까다로운 처리였을텐데 너무나 대단하십니당 |
||
<> | ||
<div> | ||
{type === 'setting' ? ( | ||
<SettingCheck1Layout> | ||
<SettingCheck1Layout isHover={isHover} isPressed={isPressed}> | ||
<StlyedSettingCheck1Ic /> | ||
</SettingCheck1Layout> | ||
) : ( | ||
<DoneLayout> | ||
<StlyedDoneIc /> | ||
</DoneLayout> | ||
)} | ||
</> | ||
</div> | ||
); | ||
}; | ||
} | ||
|
||
export default Check1Btn; | ||
|
||
|
@@ -30,28 +32,35 @@ const alignCenterStyle = css` | |
align-items: center; | ||
justify-content: center; | ||
`; | ||
const SettingCheck1Layout = styled.button` | ||
const SettingCheck1Layout = styled.button<{ isHover: boolean; isPressed: boolean }>` | ||
${alignCenterStyle} | ||
width: 2.4rem; | ||
height: 2.4rem; | ||
|
||
background-color: ${({ theme }) => theme.palette.BLUE_DISABLED}; /* 수정 필요 */ | ||
background-color: ${({ theme }) => theme.palette.Blue.Blue1}; | ||
border-radius: 8px; | ||
|
||
&:hover { | ||
background-color: ${({ theme }) => theme.palette.BLUE_DISABLED}; | ||
} | ||
|
||
&:active { | ||
background-color: ${({ theme }) => theme.palette.BLUE_PASSED}; | ||
${({ isHover, theme }) => | ||
isHover && | ||
css` | ||
&:hover { | ||
background-color: ${theme.palette.Blue.Blue3}; | ||
} | ||
`} | ||
${({ isPressed, theme }) => | ||
isPressed && | ||
css` | ||
&:active { | ||
background-color: ${theme.palette.Primary}; | ||
|
||
path { | ||
stroke: ${({ theme }) => theme.palette.WITHE}; | ||
} | ||
} | ||
path { | ||
stroke: ${theme.palette.Grey.White}; | ||
} | ||
} | ||
`} | ||
`; | ||
|
||
const StlyedSettingCheck1Ic = styled(Icons.SettingCheck1)` | ||
const StlyedSettingCheck1Ic = styled(Icons.SettingIcons.SettingCheck1)` | ||
width: 1.3911rem; | ||
height: 1.3911rem; | ||
`; | ||
|
@@ -61,7 +70,7 @@ const DoneLayout = styled.button` | |
width: 3.2rem; | ||
height: 3.2rem; | ||
|
||
background-color: ${({ theme }) => theme.palette.BLUE_DISABLED}; /* 수정 필요 */ | ||
background-color: ${({ theme }) => theme.palette.Blue.Blue1}; | ||
border-radius: 10px; | ||
`; | ||
|
||
|
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.
DeleteBtnLayout
은${DeleteBtnCss}
를 받는 역할만 하고 있어서 css 분리할 필요 없이DeleteBtnLayout
안에 스타일 코드 넣어줘도 괜찮을 것 같습니다!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.
코드리뷰 반영해두었습니다!! 매번 꼼꼼한 리뷰 달아주셔서 감사합니다 ㅎㅎ