-
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
feat: 퀴즈 결과 페이지 추가
- Loading branch information
Showing
17 changed files
with
260 additions
and
18 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.
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,14 @@ | ||
import React from 'react' | ||
import { Header } from '@/components/domain/quiz/result' | ||
|
||
type LayoutProps = { | ||
children: React.ReactNode | ||
} | ||
export default function QuizResultLayout({ children }: LayoutProps) { | ||
return ( | ||
<div className="pb-4 h-full"> | ||
<Header /> | ||
<div className="h-[calc(100%-80px)]">{children}</div> | ||
</div> | ||
) | ||
} |
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,38 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
import Image from 'next/image' | ||
import { QuizResultCard } from '@/components/domain/quiz/result' | ||
import { quizCardResultData } from '@/constants/resultData' | ||
import { getQuizResult } from '@/utils/getQuizResult' | ||
|
||
function QuizResult() { | ||
const correctCount = quizCardResultData.correctCount | ||
const { imageSrc, altText, resultText } = getQuizResult(correctCount) | ||
|
||
return ( | ||
<div className="px-4 flex flex-col items-center justify-between h-full"> | ||
<Image src={imageSrc} alt={altText} width={180} height={180} /> | ||
<p className="text-body1 text-onSurface-300">{resultText}</p> | ||
<div className="flex text-h1"> | ||
<p className="text-primary-400">{quizCardResultData.correctCount}</p> | ||
<p className="text-onSurface-300">개 정답!</p> | ||
</div> | ||
{quizCardResultData.explanationInfo.map((card, index) => { | ||
return ( | ||
<QuizResultCard | ||
key={index} | ||
wordId={card.wordId} | ||
isCorrect={card.isCorrect} | ||
isMarked={card.isMarked} | ||
name={card.name} | ||
selectedOptionDescription={card.selectedOptionDescription} | ||
answerOptionDescription={card.answerOptionDescription} | ||
/> | ||
) | ||
})} | ||
</div> | ||
) | ||
} | ||
|
||
export default QuizResult |
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 @@ | ||
export { default as QuizResultCard } from './QuizResultCard' |
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,25 @@ | ||
'use client' | ||
|
||
import React from 'react' | ||
import Image from 'next/image' | ||
import { useRouter } from 'next/navigation' | ||
|
||
function Header() { | ||
const router = useRouter() | ||
|
||
return ( | ||
<div className="px-4 flex flex-shrink-0 h-20"> | ||
<Image | ||
src={'/icons/cross.svg'} | ||
alt="cross.svg" | ||
onClick={() => router.push('/home/dictionary')} | ||
className="cursor-pointer" | ||
width={24} | ||
height={24} | ||
/> | ||
<p className="m-auto text-sub1 text-onSurface-300">퀴즈결과</p> | ||
</div> | ||
) | ||
} | ||
|
||
export default Header |
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 @@ | ||
export { default as Header } from './Header' |
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,2 @@ | ||
export * from './header' | ||
export * from './QuizResultCard' |
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,91 @@ | ||
import { ExplanationInfo, QuizResult } from '@/types/quizresult' | ||
|
||
export interface ResultData { | ||
id: number | ||
result: string | ||
img: string | ||
altText: string | ||
} | ||
|
||
export const resultData: ResultData[] = [ | ||
{ | ||
id: 0, | ||
result: '아직은 외계어 같은 용어들 👽', | ||
img: '/images/quiz_result_00.svg', | ||
altText: 'quiz_result_00.svg', | ||
}, | ||
{ | ||
id: 1, | ||
result: '업무 소통계의 떠오르는 샛별 ✨', | ||
img: '/images/quiz_result_01.svg', | ||
altText: 'quiz_result_01.svg', | ||
}, | ||
{ | ||
id: 2, | ||
result: '업무 소통 역량 로켓 상승 중 🚀', | ||
img: '/images/quiz_result_02.svg', | ||
altText: 'quiz_result_02.svg', | ||
}, | ||
{ | ||
id: 3, | ||
result: '혜성처럼 나타난 업무 소통 능력자 ☄️', | ||
img: '/images/quiz_result_03.svg', | ||
altText: 'quiz_result_03.svg', | ||
}, | ||
] | ||
|
||
export const quizCardResultData: QuizResult = { | ||
id: 1, | ||
correctCount: 5, | ||
explanationInfo: [ | ||
{ | ||
wordId: 1, | ||
isCorrect: true, | ||
isMarked: true, | ||
name: '아젠다(Agenda)', | ||
selectedOptionDescription: | ||
'완수해야 하는 실무 내용을 사전에 정리해 둔 항목들', | ||
answerOptionDescription: | ||
'완수해야 하는 실무 내용을 사전에 정리해 둔 항목들', | ||
}, | ||
{ | ||
wordId: 7, | ||
isCorrect: true, | ||
isMarked: true, | ||
name: '목 데이터(Mock Data)', | ||
selectedOptionDescription: | ||
'실제 데이터를 대신하여 개발이나 테스트에 사용하는 가상의 데이터', | ||
answerOptionDescription: | ||
'실제 데이터를 대신하여 개발이나 테스트에 사용하는 가상의 데이터', | ||
}, | ||
{ | ||
wordId: 10, | ||
isCorrect: true, | ||
isMarked: true, | ||
name: '스크럼(Scrum)', | ||
selectedOptionDescription: | ||
'애자일 방법론 중 하나로, 일정 기간 동안 작은 단위의 작업을 반복하여 진행', | ||
answerOptionDescription: | ||
'애자일 방법론 중 하나로, 일정 기간 동안 작은 단위의 작업을 반복하여 진행', | ||
}, | ||
{ | ||
wordId: 13, | ||
isCorrect: true, | ||
isMarked: true, | ||
name: '넛지(Nudge)', | ||
selectedOptionDescription: | ||
'사용자의 행동을 유도, 관찰된 동작에 대한 간접적인 힌트 제공으로 사용자 경험을 개선하는 개념', | ||
answerOptionDescription: | ||
'사용자의 행동을 유도, 관찰된 동작에 대한 간접적인 힌트 제공으로 사용자 경험을 개선하는 개념', | ||
}, | ||
{ | ||
wordId: 18, | ||
isCorrect: true, | ||
isMarked: true, | ||
name: '가시화(Visualization)', | ||
selectedOptionDescription: | ||
'데이터나 정보를 그래프 등의 시각적 형태로 표현', | ||
answerOptionDescription: '데이터나 정보를 그래프 등의 시각적 형태로 표현', | ||
}, | ||
], | ||
} |
File renamed without changes.
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
export interface ExplantionInfoType { | ||
export interface ExplanationInfo { | ||
wordId: number | ||
isCorrect: boolean | ||
isMarked: boolean | ||
name: 'string' | ||
selectedOptionDescription: 'string' | ||
answerOptionDescription: 'string' | ||
name: string | ||
selectedOptionDescription: string | ||
answerOptionDescription: string | ||
} | ||
|
||
export interface QuizResultType { | ||
export interface QuizResult { | ||
id: number | ||
correctCount: number | ||
explanationInfo: ExplantionInfoType[] | ||
explanationInfo: ExplanationInfo[] | ||
} |
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,34 @@ | ||
// 파일 경로: src/utils/getQuizResult.js | ||
|
||
import { resultData } from '@/constants/resultData' | ||
|
||
export function getQuizResult(correctCount: number) { | ||
let imageSrc, altText, resultText | ||
|
||
switch (correctCount) { | ||
case 1: | ||
case 2: | ||
imageSrc = resultData[1].img! | ||
altText = resultData[1].altText! | ||
resultText = resultData[1].result | ||
break | ||
case 3: | ||
case 4: | ||
imageSrc = resultData[2].img! | ||
altText = resultData[2].altText! | ||
resultText = resultData[2].result | ||
break | ||
case 5: | ||
imageSrc = resultData[3].img! | ||
altText = resultData[3].altText! | ||
resultText = resultData[3].result | ||
break | ||
default: | ||
imageSrc = resultData[0].img! | ||
altText = resultData[0].altText! | ||
resultText = resultData[0].result | ||
break | ||
} | ||
|
||
return { imageSrc, altText, resultText } | ||
} |