-
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cb51592
[feat] 필요한 색상 추가
16010948 bc56525
[feat] XButton 컴포넌트 구현
16010948 249fb13
[feat] SearchFilter 컴포넌트 구현
16010948 5b1b922
[feat] 필요한 svg 추가
16010948 08f6374
[feat] Input 컴포넌트 구현
16010948 3f6f31b
[refactor] svg 필요 없는 태그 삭제
16010948 a45043b
[refactor] XButton 오타 및 props 변경
16010948 0214c4b
[refactor] Input Component 수정
16010948 1ac0e49
[refactor] search filter component 세분화
16010948 ce01e1d
[refactor] search filter molecules -> organisms로 변경
16010948 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
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,16 @@ | ||
import React, { useState } from 'react'; | ||
import { text } from '@storybook/addon-knobs'; | ||
import FilterInput from './FilterInput'; | ||
|
||
export default { | ||
component: FilterInput, | ||
title: 'FilterInput', | ||
}; | ||
export const Default = () => { | ||
const content = text('content', 'content'); | ||
const type = text('type', 'button'); | ||
const onClick = () => { | ||
// 버튼 메서드 | ||
}; | ||
return <FilterInput type={type} content={content} onClick={onClick} />; | ||
}; |
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,39 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import styled from '@themes/styled'; | ||
|
||
interface Props { | ||
content: string; | ||
onClick?: () => void; | ||
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
type: string; | ||
} | ||
|
||
const StyledInput = styled.input` | ||
font-size: 1rem; | ||
text-decoration: none; | ||
border: none; | ||
background-color: rgba(0, 0, 0, 0); | ||
cursor: pointer; | ||
&:focus { | ||
outline: none; | ||
} | ||
`; | ||
|
||
const FilterInput: FunctionComponent<Props> = ({ | ||
type, | ||
content, | ||
onClick, | ||
onChange, | ||
}) => { | ||
return ( | ||
<StyledInput | ||
type={type} | ||
onClick={onClick} | ||
onChange={onChange} | ||
value={content} | ||
/> | ||
); | ||
}; | ||
|
||
export default FilterInput; |
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 +1,2 @@ | ||
export { default } from './Input'; | ||
export { default as Input } from './Input'; | ||
export { default as FilterInput } from './FilterInput'; |
55 changes: 55 additions & 0 deletions
55
client/src/components/molecules/FilterModal/FilterModal.stories.tsx
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,55 @@ | ||
import React, { useState } from 'react'; | ||
import { text } from '@storybook/addon-knobs'; | ||
import FilterModal from './FilterModal'; | ||
|
||
export default { | ||
component: FilterModal, | ||
title: 'FilterModal', | ||
}; | ||
export const Default = () => { | ||
const optionHeader = text('optionHeader', 'Filter Issues'); | ||
const options = [ | ||
'Open issues', | ||
'Your issues', | ||
'Everything assigned to you', | ||
'Everything mentioning to you', | ||
'Closed issues', | ||
]; | ||
const type = 'button'; | ||
const keys = ['search1', 'search2', 'search3', 'search4', 'search5']; | ||
const onClick = () => { | ||
// modal button 클릭 시 | ||
}; | ||
return ( | ||
<FilterModal | ||
display="block" | ||
optionHeader={optionHeader} | ||
options={options} | ||
onClick={onClick} | ||
type={type} | ||
keys={keys} | ||
/> | ||
); | ||
}; | ||
|
||
export const Author = () => { | ||
const optionHeader = text('optionHeader', 'Filter by author'); | ||
const options = ['user1', 'user2', 'user3', 'user4', 'user5']; | ||
const onClick = () => { | ||
// modal button 클릭 시 | ||
}; | ||
const type = 'checkbox'; | ||
const keys = ['radio1', 'radio2', 'radio3', 'radio4', 'radio5']; | ||
const input = 'Filter users'; | ||
return ( | ||
<FilterModal | ||
display="block" | ||
optionHeader={optionHeader} | ||
options={options} | ||
onClick={onClick} | ||
type={type} | ||
input={input} | ||
keys={keys} | ||
/> | ||
); | ||
}; |
75 changes: 75 additions & 0 deletions
75
client/src/components/molecules/FilterModal/FilterModal.tsx
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,75 @@ | ||
import React, { FunctionComponent } from 'react'; | ||
import styled from '@themes/styled'; | ||
import { Input, FilterInput } from '@components/atoms/Input'; | ||
|
||
interface Props { | ||
optionHeader: string; | ||
options: string[]; | ||
onClick?: () => void; | ||
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
input?: string; | ||
type: string; | ||
keys: string[]; | ||
display: string; | ||
} | ||
|
||
const StyledUl = styled.ul` | ||
border-radius: 0.3rem; | ||
list-style: none; | ||
border: 1px solid ${({ theme }) => theme.palette.BORDER_COLOR}; | ||
max-width: 300px; | ||
margin: 10px 0; | ||
`; | ||
|
||
const StyledLi = styled.li` | ||
& > h3 { | ||
font-weight: 600; | ||
} | ||
& > input { | ||
width: 100%; | ||
text-align: left; | ||
} | ||
& > input, | ||
& > h3 { | ||
color: ${({ theme }) => theme.palette.PRIMARY}; | ||
font-size: 0.8rem; | ||
padding: 7px 16px; | ||
border-bottom: 1px solid ${({ theme }) => theme.palette.BORDER_COLOR}; | ||
} | ||
& > input:hover { | ||
background-color: ${({ theme }) => theme.palette.BG_COLOR02}; | ||
} | ||
& > input:focus { | ||
outline: none; | ||
} | ||
`; | ||
|
||
const SearchFilter: FunctionComponent<Props> = ({ | ||
optionHeader, | ||
options, | ||
onClick, | ||
type, | ||
input, | ||
display, | ||
keys, | ||
}) => { | ||
return ( | ||
<StyledUl style={{ display }}> | ||
<StyledLi> | ||
<h3>{optionHeader}</h3> | ||
</StyledLi> | ||
{input ? <Input placeholder={input} type="text" /> : <></>} | ||
{options.map((option: string, i: number) => ( | ||
<StyledLi key={keys[i]}> | ||
<FilterInput type={type} content={option} onClick={onClick} /> | ||
</StyledLi> | ||
))} | ||
</StyledUl> | ||
); | ||
}; | ||
|
||
export default SearchFilter; |
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 @@ | ||
export { default } from './FilterModal'; |
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.
display type을 string보다는 좀더 명확하게 (ex 'flex' | 'block') 하는게 좋습니당