-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[ListPage]🍝코드 정리
- Loading branch information
Showing
9 changed files
with
359 additions
and
399 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
import styled from 'styled-components'; | ||
import { IcArrowBottomSmallGray, IcArrowBottomSmallLight } from '../../assets/icon'; | ||
import { buttonType } from '../../page/ListPage'; | ||
|
||
interface FilterButtonProps { | ||
idx: number; | ||
button: buttonType; | ||
setSheetOpen: React.Dispatch<React.SetStateAction<number>>; | ||
} | ||
const FilterButton = ({ idx, button, setSheetOpen }: FilterButtonProps) => { | ||
const isSelectedFilter: boolean = button.default !== button.value; | ||
return ( | ||
<St.FilterBtn | ||
key={button.value} | ||
$selected={isSelectedFilter} | ||
onClick={() => { | ||
setSheetOpen(idx); // 어떤 필터 버튼을 클릭했는지에 따라 isSheetOpen 값이 0, 1, 2로 바뀜 | ||
}} | ||
> | ||
{button.value} | ||
{isSelectedFilter ? <IcArrowBottomSmallLight /> : <IcArrowBottomSmallGray />} | ||
</St.FilterBtn> | ||
); | ||
}; | ||
|
||
export default FilterButton; | ||
|
||
const St = { | ||
FilterBtn: styled.button<{ $selected: boolean }>` | ||
display: flex; | ||
padding: 0.6rem 0.7rem 0.6rem 1.3rem; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 0.3rem; | ||
border-radius: 0.5rem; | ||
background-color: ${({ theme, $selected }) => | ||
$selected ? theme.colors.gray7 : theme.colors.bg}; | ||
color: ${({ theme, $selected }) => ($selected ? theme.colors.white : theme.colors.gray3)}; | ||
${({ theme }) => theme.fonts.body_medium_14}; | ||
`, | ||
}; |
Oops, something went wrong.