-
Notifications
You must be signed in to change notification settings - Fork 4
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
Jy/XButton, Input, Search Filter 구현 #97
Changes from 1 commit
cb51592
bc56525
249fb13
5b1b922
08f6374
3f6f31b
a45043b
0214c4b
1ac0e49
ce01e1d
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,17 @@ | ||
import React from 'react'; | ||
import { text } from '@storybook/addon-knobs'; | ||
import { Reset } from '@components/atoms/Icons'; | ||
import XButton from './XButton'; | ||
|
||
export default { | ||
component: XButton, | ||
title: 'XButton', | ||
}; | ||
export const Default = () => { | ||
const value = text('value', 'Clear current search query, filters, and sorts'); | ||
const Icon = Reset; | ||
const onClick = (e: React.ChangeEvent<HTMLInputElement>) => { | ||
// 필터 초기화 | ||
}; | ||
return <XButton Icon={Icon} value={value} onClick={onClick} />; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import styled from '@themes/styled'; | ||
|
||
interface Props { | ||
Icon: FunctionComponent; | ||
value: string; | ||
onClick: (e: React.MouseEvent<HTMLButtonElement>) => void; | ||
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. onclick에서는 event 객체를 활용할 일이 없을 것으로 생각됩니다! |
||
} | ||
|
||
const StyledButton = styled.button` | ||
font-size: 1rem; | ||
font-weight: 600; | ||
text-align: center; | ||
color: ${({ theme }) => theme.palette.SECONDARY}; | ||
text-decoration: none; | ||
border: none; | ||
opacity: 1; | ||
|
||
cursor: pointer; | ||
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. 속성끼리는 붙이고 & > 같은 다른 스타일 적용할 때만 띄워주면 좋을 것 같아요 |
||
& > svg { | ||
width: 18px; | ||
height: 18px; | ||
padding: 1px; | ||
margin-right: 3px; | ||
fill: ${({ theme }) => theme.palette.LIGHT}; | ||
background-color: ${({ theme }) => theme.palette.SECONDARY}; | ||
border-radius: 6px; | ||
border: none; | ||
} | ||
|
||
&:hover { | ||
color: ${({ theme }) => theme.palette.LINK_BLUE}; | ||
} | ||
|
||
&:hover svg { | ||
background-color: ${({ theme }) => theme.palette.LINK_BLUE}; | ||
} | ||
|
||
&:focus { | ||
outline: none; | ||
} | ||
`; | ||
|
||
const XButton: FunctionComponent<Props> = ({ Icon, value, onClick }) => { | ||
return ( | ||
<StyledButton onClick={onClick}> | ||
<Icon /> | ||
{value} | ||
</StyledButton> | ||
); | ||
}; | ||
|
||
export default XButton; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './XButton'; |
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.
나중을 위해서 onclick에 어떤 메소드가 들어갈지 적어준 부분 너무 좋아요~!