-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 범용적인 DropDown 컴포넌트를 celuveat-ui-library 배포 후 적용 (#652)
* chore: celuveat-ui-library 설치 * refactor: celuveat-library를 적용, InfoDropDown 코드 수정 * fix: svg 경로로 인한 storybook 에러 해결 * refactor: celuveat-library를 적용, CelebDropDown 코드 수정 * fix: github action ci 오류 수정 * fix: 사용하지 않은 memo 제거 (#650)
- Loading branch information
Showing
15 changed files
with
3,716 additions
and
3,991 deletions.
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
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
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
39 changes: 39 additions & 0 deletions
39
frontend/src/components/CelebDropDown/CelebDropDownOption.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,39 @@ | ||
import { styled } from 'styled-components'; | ||
import { Celeb } from '~/@types/celeb.types'; | ||
import ProfileImage from '~/components/@common/ProfileImage'; | ||
import { FONT_SIZE } from '~/styles/common'; | ||
|
||
import CelebIcon from '~/assets/icons/celeb.svg'; | ||
|
||
interface CelebDropDownOptionProps { | ||
celeb: Celeb; | ||
} | ||
|
||
function CelebDropDownOption({ celeb }: CelebDropDownOptionProps) { | ||
return ( | ||
<div> | ||
{celeb.id === -1 ? ( | ||
<CelebIcon /> | ||
) : ( | ||
<ProfileImage name={celeb.name} imageUrl={celeb.profileImageUrl} size="32px" /> | ||
)} | ||
<div> | ||
<StyledCelebName>{celeb.name}</StyledCelebName> | ||
<StyledChannelName>{celeb.youtubeChannelName}</StyledChannelName> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default CelebDropDownOption; | ||
|
||
const StyledCelebName = styled.div` | ||
font-family: SUIT-Medium, sans-serif; | ||
`; | ||
|
||
const StyledChannelName = styled.div` | ||
padding-top: 0.4rem; | ||
color: var(--gray-3); | ||
font-size: ${FONT_SIZE.sm}; | ||
`; |
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,26 @@ | ||
import NavItem from '~/components/@common/NavItem'; | ||
import ProfileImage from '~/components/@common/ProfileImage'; | ||
import CelebIcon from '~/assets/icons/celeb.svg'; | ||
|
||
import { Celeb } from '~/@types/celeb.types'; | ||
|
||
interface CelebNavItemProps { | ||
celeb: Celeb; | ||
} | ||
|
||
function CelebNavItem({ celeb }: CelebNavItemProps) { | ||
return ( | ||
<div> | ||
{celeb.id === -1 ? ( | ||
<NavItem label="전체 셀럽" icon={<CelebIcon />} /> | ||
) : ( | ||
<NavItem | ||
label={celeb.youtubeChannelName.replace('@', '')} | ||
icon={<ProfileImage name={celeb.name} imageUrl={celeb.profileImageUrl} size="40px" />} | ||
/> | ||
)} | ||
</div> | ||
); | ||
} | ||
|
||
export default CelebNavItem; |
27 changes: 27 additions & 0 deletions
27
frontend/src/components/CelebDropDown/hooks/useCelebSelect.ts
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 { useState } from 'react'; | ||
import { shallow } from 'zustand/shallow'; | ||
import { OPTION_FOR_CELEB_ALL } from '~/constants/options'; | ||
import useRestaurantsQueryStringState from '~/hooks/store/useRestaurantsQueryStringState'; | ||
|
||
import { Celeb } from '~/@types/celeb.types'; | ||
|
||
export const useCelebSelect = () => { | ||
const [selectedCeleb, setSelectedCeleb] = useState<Celeb>(OPTION_FOR_CELEB_ALL); | ||
|
||
const [setCelebId, setCurrentPage] = useRestaurantsQueryStringState( | ||
state => [state.setCelebId, state.setCurrentPage], | ||
shallow, | ||
); | ||
|
||
const selectCeleb = (celeb: Celeb) => () => { | ||
setCelebId(celeb.id); | ||
setCurrentPage(0); | ||
|
||
setSelectedCeleb(celeb); | ||
}; | ||
|
||
return { | ||
selectedCeleb, | ||
selectCeleb, | ||
}; | ||
}; |
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
Oops, something went wrong.