-
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.
Merge pull request #54 from depromeet/feat/select-page
[Task] 미션등록페이지 구현 (#31)
- Loading branch information
Showing
22 changed files
with
397 additions
and
6 deletions.
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.
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,24 @@ | ||
import { type SVGProps } from 'react'; | ||
|
||
/** | ||
* TODO : Icon 컴포넌트로 변경 | ||
*/ | ||
export default function CheckCircleIcon(props: SVGProps<SVGSVGElement>) { | ||
return ( | ||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<g clipPath="url(#clip0_44_466)" {...props}> | ||
<path | ||
fillRule="evenodd" | ||
clipRule="evenodd" | ||
d="M12 0C5.37258 0 0 5.37258 0 12C0 18.6274 5.37258 24 12 24C18.6274 24 24 18.6274 24 12C24 5.37258 18.6274 0 12 0ZM17.4366 10.2365C17.7881 9.88502 17.7881 9.31517 17.4366 8.9637C17.0851 8.61223 16.5153 8.61223 16.1638 8.9637L10.8108 14.3167L7.83659 11.3425C7.48512 10.991 6.91527 10.991 6.5638 11.3425C6.21233 11.6939 6.21233 12.2638 6.5638 12.6153L10.1744 16.2259C10.5259 16.5773 11.0957 16.5773 11.4472 16.2259L17.4366 10.2365Z" | ||
fill="#929DFF" | ||
/> | ||
</g> | ||
<defs> | ||
<clipPath id="clip0_44_466"> | ||
<rect width="24" height="24" fill="white" /> | ||
</clipPath> | ||
</defs> | ||
</svg> | ||
); | ||
} |
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,21 @@ | ||
import Image from 'next/image'; | ||
import RadioInput, { type RadioInputProps } from '@/components/RadioInput'; | ||
import { css } from '@styled-system/css'; | ||
|
||
interface RadioInputWithEmojiProps extends RadioInputProps { | ||
imgSrc: string; | ||
label: string; | ||
} | ||
|
||
export default function RadioInputWithImg({ imgSrc, label, ...props }: RadioInputWithEmojiProps) { | ||
return ( | ||
<RadioInput {...props}> | ||
<Image src={imgSrc} width={36} height={36} alt={label} className={emojiBoxCss} /> | ||
{label} | ||
</RadioInput> | ||
); | ||
} | ||
|
||
const emojiBoxCss = css({ | ||
marginRight: '8px', | ||
}); |
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,79 @@ | ||
'use client'; | ||
|
||
import { useState } from 'react'; | ||
import { useRouter } from 'next/navigation'; | ||
import RadioInputWithImg from '@/app/select/RadioInputWithImg'; | ||
import { MISSION_CATEGORIES } from '@/app/select/select.constants'; | ||
import Button from '@/components/Button'; | ||
import { ROUTER } from '@/constants/router'; | ||
import { withQueryString } from '@/utils'; | ||
import { getObjectValues } from '@/utils/object'; | ||
import { css } from '@styled-system/css'; | ||
import { flex } from '@styled-system/patterns'; | ||
|
||
export default function SelectMissionForm() { | ||
const { push } = useRouter(); | ||
const [selectedCategory, setSelectedCategory] = useState<string | null>(null); | ||
|
||
const handleClick = () => { | ||
if (selectedCategory === null) { | ||
alert('카테고리를 선택해주세요'); | ||
return; | ||
} | ||
|
||
push(withQueryString(ROUTER.TIMER, { category: selectedCategory })); | ||
}; | ||
|
||
const handleRadioChange = (value: string) => { | ||
setSelectedCategory(value); | ||
}; | ||
|
||
return ( | ||
<section className={sectionCss}> | ||
<div className={listCss}> | ||
{getObjectValues(MISSION_CATEGORIES).map((category) => ( | ||
<RadioInputWithImg | ||
key={category.id} | ||
onChange={handleRadioChange} | ||
imgSrc={category.imgSrc} | ||
label={category.label} | ||
name={'category'} | ||
value={category.id} | ||
/> | ||
))} | ||
</div> | ||
<Button disabled={!selectedCategory} onClick={handleClick} className={nextButtonCss}> | ||
다음 | ||
</Button> | ||
</section> | ||
); | ||
} | ||
|
||
const nextButtonCss = css({ | ||
padding: '16px 24px', | ||
textStyle: 'subtitle2', | ||
color: '#FFFFFF', | ||
width: 'fit', | ||
borderRadius: '30px', | ||
background: '#929DFF', | ||
transition: '0.3s ease', | ||
cursor: 'pointer', | ||
_disabled: { | ||
background: '#E5E5E5', | ||
}, | ||
}); | ||
|
||
const sectionCss = flex({ | ||
marginTop: '30px', | ||
width: '100%', | ||
flex: 1, | ||
flexDirection: 'column', | ||
justifyContent: 'space-between', | ||
alignItems: 'end', | ||
}); | ||
|
||
const listCss = flex({ | ||
width: '100%', | ||
flexDirection: 'column', | ||
gap: '6px', | ||
}); |
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 { type PropsWithChildren } from 'react'; | ||
import { css } from '@styled-system/css'; | ||
|
||
export default function Layout({ children }: PropsWithChildren) { | ||
return <div className={containerCss}>{children}</div>; | ||
} | ||
|
||
const containerCss = css({ | ||
maxWidth: '475px', | ||
margin: '0 auto', | ||
minHeight: '100vh', | ||
|
||
display: 'flex', | ||
flexDirection: 'column', | ||
flex: 1, | ||
}); |
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,49 @@ | ||
import SelectMissionForm from '@/app/select/SelectMissionForm'; | ||
import Header from '@/components/Layout/Header'; | ||
import { css } from '@styled-system/css'; | ||
|
||
export default function SelectPage() { | ||
return ( | ||
<main className={mainWrapperCss}> | ||
<Header title={'미션 등록'} /> | ||
<div className={containerCss}> | ||
<h1 className={mainTitleCss}> | ||
하루 <strong>10분</strong>을 <br /> | ||
어떤 일에 투자하고 싶은가요? | ||
</h1> | ||
<SelectMissionForm /> | ||
</div> | ||
</main> | ||
); | ||
} | ||
// TODO : 컬러 theme으로 적용 | ||
const grey800 = '#333D4B'; | ||
const purple = '#8D96F0'; | ||
|
||
const mainWrapperCss = css({ | ||
flex: 1, | ||
display: 'flex', | ||
flexDirection: 'column', | ||
|
||
width: '100%', | ||
}); | ||
|
||
const containerCss = css({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
flex: 1, | ||
|
||
padding: '24px 16px', | ||
}); | ||
|
||
const mainTitleCss = css({ | ||
marginTop: '2px', | ||
|
||
textStyle: 'title2', | ||
|
||
color: grey800, | ||
'& strong': { | ||
color: purple, | ||
textStyle: 'title2', | ||
}, | ||
}); |
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,32 @@ | ||
export const MISSION_CATEGORIES = { | ||
exercise: { | ||
id: 'exercise', | ||
label: '운동', | ||
imgSrc: '/images/emoji-exercise.png', | ||
}, | ||
study: { | ||
id: 'study', | ||
label: '공부', | ||
imgSrc: '/images/emoji-book.png', | ||
}, | ||
reading: { | ||
id: 'reading', | ||
label: '글 읽기', | ||
imgSrc: '/images/emoji-open-book.png', | ||
}, | ||
writing: { | ||
id: 'writing', | ||
label: '글 쓰기', | ||
imgSrc: '/images/emoji-pen.png', | ||
}, | ||
video: { | ||
id: 'video', | ||
label: '영상 보기 / 팟캐스트 듣기', | ||
imgSrc: '/images/emoji-laptop.png', | ||
}, | ||
etc: { | ||
id: 'etc', | ||
label: '기타', | ||
imgSrc: '/images/emoji-speech-bubble.png', | ||
}, | ||
} as const; |
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
Oops, something went wrong.