-
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
✨ 미션 선택 Bottom Sheet 연결 #118
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
2a02abd
🎨 공통 컴포넌트 스타일 수정
sumi-0011 f91282f
✨ 카테고리 바텀시트 toggle 추가
sumi-0011 5e08502
✨ 카테고리 선택 바텀시트 연결
sumi-0011 50b029b
✨ 공개 범위, 카테고리 바텀시트 추가
sumi-0011 f6f4418
Merge branch 'design/category-ui' into feat/mission-bottomsheet
sumi-0011 8faf1c0
🎨 준호의 select view에 연결
sumi-0011 a94b7a5
Merge branch 'develop' into feat/mission-bottomsheet
sumi-0011 6057c61
Merge branch 'develop' into feat/mission-bottomsheet
sumi-0011 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,98 @@ | ||
import { type ComponentProps } from 'react'; | ||
import Image from 'next/image'; | ||
import BottomSheet from '@/components/BottomSheet/BottomSheet'; | ||
import Header from '@/components/Header'; | ||
import Icon from '@/components/Icon'; | ||
import { css } from '@/styled-system/css'; | ||
|
||
const CATEGORY = [ | ||
{ | ||
name: '운동', | ||
image: '/images/category/exercise.png', | ||
}, | ||
{ | ||
name: '공부', | ||
image: '/images/category/study.png', | ||
}, | ||
{ | ||
name: '글 읽기', | ||
image: '/images/category/reading.png', | ||
}, | ||
{ | ||
name: '글 쓰기', | ||
image: '/images/category/writting.png', | ||
}, | ||
{ | ||
name: '프로젝트 / 작업', | ||
image: '/images/category/laptop.png', | ||
}, | ||
{ | ||
name: '영상 보기 / 팟캐스트 듣기', | ||
image: '/images/category/play-button.png', | ||
}, | ||
{ | ||
name: '기타', | ||
image: '/images/category/exercise.png', | ||
}, | ||
]; | ||
|
||
interface Props extends Omit<ComponentProps<typeof BottomSheet>, 'headerElement'> { | ||
select: string | null; | ||
onSelect: (category: string) => void; | ||
} | ||
|
||
function CategoryBottomSheet(props: Props) { | ||
const onClick = (name: string) => { | ||
props.onSelect(name); | ||
props.onClickOutside?.(); | ||
}; | ||
|
||
return ( | ||
<BottomSheet headerElement={<Header.None title="카테고리" />} {...props}> | ||
<ul className={categoryListCss}> | ||
{CATEGORY.map((item) => ( | ||
<li key={item.name} className={categoryItemCss} onClick={() => onClick(item.name)}> | ||
<div> | ||
<div className={imageWrapperCss}> | ||
<Image src={item.image} alt={item.name} fill /> | ||
</div> | ||
<div>{item.name}</div> | ||
</div> | ||
<div>{props.select === item.name && <Icon name="check-circle" color="purple.purple700" />}</div> | ||
</li> | ||
))} | ||
</ul> | ||
</BottomSheet> | ||
); | ||
} | ||
|
||
export default CategoryBottomSheet; | ||
|
||
const categoryListCss = css({ | ||
width: '100%', | ||
}); | ||
|
||
const categoryItemCss = css({ | ||
position: 'relative', | ||
width: '100%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
padding: '12px 16px', | ||
color: 'text.secondary', | ||
textStyle: 'subtitle3', | ||
height: '46px', | ||
cursor: 'pointer', | ||
|
||
'& div': { | ||
display: 'flex', | ||
gap: '8px', | ||
alignItems: 'center', | ||
}, | ||
}); | ||
|
||
const imageWrapperCss = css({ | ||
position: 'relative', | ||
width: '28px', | ||
height: '28px', | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React, { type ComponentProps } from 'react'; | ||
import BottomSheet from '@/components/BottomSheet/BottomSheet'; | ||
import Header from '@/components/Header'; | ||
import Icon from '@/components/Icon'; | ||
import { css } from '@/styled-system/css'; | ||
|
||
interface Props extends Omit<ComponentProps<typeof BottomSheet>, 'headerElement'> { | ||
select: string | null; | ||
onSelect: (name: string) => void; | ||
} | ||
|
||
const PUBLIC_LIST = [{ name: '팔로워에게 공개' }, { name: '전체 공개' }, { name: '비공개' }]; | ||
|
||
function PublicBottomSheet(props: Props) { | ||
const onClick = (name: string) => { | ||
props.onSelect(name); | ||
}; | ||
|
||
return ( | ||
<BottomSheet headerElement={<Header.TextButton title="카테고리" onButtonClick={props.onClickOutside} />} {...props}> | ||
<ul className={listCss}> | ||
{PUBLIC_LIST.map((item) => ( | ||
<li key={item.name} className={itemCss} onClick={() => onClick(item.name)}> | ||
<div>{item.name}</div> | ||
<div>{props.select === item.name && <Icon name="check-circle" color="purple.purple700" />}</div> | ||
</li> | ||
))} | ||
</ul> | ||
</BottomSheet> | ||
); | ||
} | ||
|
||
export default PublicBottomSheet; | ||
|
||
const listCss = css({ | ||
width: '100%', | ||
}); | ||
|
||
const itemCss = css({ | ||
position: 'relative', | ||
width: '100%', | ||
display: 'flex', | ||
alignItems: 'center', | ||
justifyContent: 'space-between', | ||
padding: '12px 16px', | ||
color: 'text.secondary', | ||
textStyle: 'subtitle3', | ||
height: '46px', | ||
cursor: 'pointer', | ||
|
||
'& div': { | ||
display: 'flex', | ||
gap: '8px', | ||
alignItems: 'center', | ||
}, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { useCallback, useState } from 'react'; | ||
|
||
type Return = readonly [boolean, VoidFunction, VoidFunction, VoidFunction]; | ||
|
||
/** | ||
* boolean을 쉽게 다룰 수 있는 hook 입니다 | ||
* | ||
* @param initialValue - 기본 boolean 값 | ||
* @returns [boolean state, toggle func, set true func, set false func] | ||
*/ | ||
const useToggle = (initialValue?: boolean): Return => { | ||
const [value, setValue] = useState(initialValue ?? false); | ||
|
||
const setTrue = useCallback(() => { | ||
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. 혹시 useCallback으로 하지 않아도 될것 같은데 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. 복붙했어요.. |
||
setValue(true); | ||
}, []); | ||
|
||
const setFalse = useCallback(() => { | ||
setValue(false); | ||
}, []); | ||
|
||
const toggle = useCallback(() => { | ||
setValue((prev) => !prev); | ||
}, []); | ||
|
||
return [value, toggle, setTrue, setFalse]; | ||
}; | ||
|
||
export default useToggle; |
Oops, something went wrong.
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.
이 부분은 오타인거겠죠?? 제가 뷰 구현하다 실수한 부분같아요 죄송합니다ㅠ_ㅠ