-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 페이지 구성 및 연결 * feat: Stepper 구현 * refactor: 상위 컴포넌트에서 훅 props로 받아쓰도록 변경 * feat: 온보딩 이미지 추가 * feat: step에 따른 내용 추가 * test: args 설정 * refactor: 리뷰 반영 * feat: 첫 방문시 온보딩 페이지로 리디렉션
- Loading branch information
Showing
15 changed files
with
236 additions
and
4 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.
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 { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Stepper from './Stepper'; | ||
|
||
const meta: Meta<typeof Stepper> = { | ||
title: 'common/Stepper', | ||
component: Stepper, | ||
args: { | ||
selectedStepper: '0', | ||
}, | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Default: Story = {}; |
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,35 @@ | ||
import type { MouseEventHandler } from 'react'; | ||
|
||
import { container, stepper, wrapper } from './stepper.css'; | ||
|
||
interface StepperProps { | ||
selectedStepper: number; | ||
handleStepperSelect: (selectedStepper: string) => void; | ||
} | ||
|
||
const Stepper = ({ selectedStepper, handleStepperSelect }: StepperProps) => { | ||
const handleStepperClick: MouseEventHandler<HTMLButtonElement> = (event) => { | ||
handleStepperSelect(event.currentTarget.value); | ||
}; | ||
|
||
return ( | ||
<ul className={container}> | ||
{Array.from({ length: 3 }, (_, index) => { | ||
const isSelected = selectedStepper === index; | ||
|
||
return ( | ||
<li key={index} className={wrapper}> | ||
<button | ||
className={isSelected ? stepper['active'] : stepper['default']} | ||
type="button" | ||
value={index} | ||
onClick={handleStepperClick} | ||
/> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
); | ||
}; | ||
|
||
export default Stepper; |
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,22 @@ | ||
import { vars } from '@/styles/theme.css'; | ||
import { style, styleVariants } from '@vanilla-extract/css'; | ||
|
||
export const container = style({ | ||
display: 'flex', | ||
gap: 10, | ||
}); | ||
|
||
export const wrapper = style({ | ||
width: '33%', | ||
}); | ||
|
||
export const stepperBase = style({ | ||
width: '100%', | ||
height: 4, | ||
cursor: 'pointer', | ||
}); | ||
|
||
export const stepper = styleVariants({ | ||
active: [stepperBase, { background: vars.colors.primary }], | ||
default: [stepperBase, { background: vars.colors.gray2 }], | ||
}); |
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,31 @@ | ||
import { contentWrapper, titleWrapper, descriptionText } from './onboardingPage.css'; | ||
|
||
import { Text } from '@/components/Common'; | ||
|
||
interface OnboardingContentProps { | ||
title: string; | ||
description: string; | ||
image: string; | ||
} | ||
|
||
const OnboardingContent = ({ title, description, image }: OnboardingContentProps) => { | ||
return ( | ||
<div className={contentWrapper}> | ||
<div className={titleWrapper}> | ||
<Text size="caption3" weight="bold" color="yellow"> | ||
{title} | ||
</Text> | ||
</div> | ||
<div style={{ height: 17 }} /> | ||
|
||
<Text size="display1" weight="semiBold" color="sub" className={descriptionText}> | ||
{description} | ||
</Text> | ||
<div style={{ height: 28 }} /> | ||
|
||
<img width={244} height={'100%'} src={image} alt="온보딩 예시" /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OnboardingContent; |
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,57 @@ | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import OnboardingContent from './OnboardingContent'; | ||
import { container, link } from './onboardingPage.css'; | ||
|
||
import OnboardingMember from '@/assets/onboarding-member.png'; | ||
import OnboardingRecipe from '@/assets/onboarding-recipe.png'; | ||
import OnboardingReview from '@/assets/onboarding-review.png'; | ||
import { Stepper, Text } from '@/components/Common'; | ||
import { PATH } from '@/constants/path'; | ||
import { useTabMenu } from '@/hooks/common'; | ||
import { setLocalStorage } from '@/utils/localStorage'; | ||
|
||
const ONBOARDING_STEPS = [ | ||
{ | ||
title: '상품 조합', | ||
description: '편의점 음식들을 이용한 \n다양한 조합을 확인할 수 있어요', | ||
image: OnboardingRecipe, | ||
}, | ||
{ | ||
title: '상품 리뷰', | ||
description: '태그, 이미지, 별점을 통해 \n정확한 리뷰를 확인할 수 있어요', | ||
image: OnboardingReview, | ||
}, | ||
{ title: '마이페이지', description: '마이페이지에서 \n나만의 조합과 리뷰를 관리해요', image: OnboardingMember }, | ||
]; | ||
|
||
export const OnboardingPage = () => { | ||
const { selectedTabMenu, handleTabMenuClick } = useTabMenu('0'); | ||
const selectedStepper = parseInt(selectedTabMenu); | ||
const content = ONBOARDING_STEPS[selectedStepper]; | ||
|
||
const navigate = useNavigate(); | ||
|
||
const handleCompleteOnboarding = () => { | ||
setLocalStorage('isRevisit', true); | ||
navigate(PATH.HOME); | ||
}; | ||
|
||
return ( | ||
<> | ||
<section className={container}> | ||
<Stepper selectedStepper={selectedStepper} handleStepperSelect={handleTabMenuClick} /> | ||
<div style={{ height: 50 }} /> | ||
|
||
<OnboardingContent title={content.title} description={content.description} image={content.image} /> | ||
</section> | ||
<button className={link} onClick={handleCompleteOnboarding}> | ||
<Text size="body" weight="bold" color="white"> | ||
시작하기 | ||
</Text> | ||
</button> | ||
</> | ||
); | ||
}; | ||
|
||
export default OnboardingPage; |
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,36 @@ | ||
import { vars } from '@/styles/theme.css'; | ||
import { style } from '@vanilla-extract/css'; | ||
|
||
export const container = style({ | ||
height: '100%', | ||
padding: '0 20px', | ||
}); | ||
|
||
export const contentWrapper = style({ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
}); | ||
|
||
export const titleWrapper = style({ | ||
width: 'fit-content', | ||
padding: '6px 16px', | ||
borderRadius: 40, | ||
background: vars.colors.black, | ||
}); | ||
|
||
export const link = style({ | ||
display: 'flex', | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
width: '100%', | ||
height: 48, | ||
padding: 16, | ||
backgroundColor: vars.colors.primary, | ||
}); | ||
|
||
export const descriptionText = style({ | ||
whiteSpace: 'pre-wrap', | ||
textAlign: '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