Skip to content

Commit

Permalink
feat: QuizCoachmark 컴포넌트 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
YuHyun-P committed Jan 13, 2024
1 parent 08f0e1b commit c9c43c1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import { EVENTS } from "react-joyride";

import { Coachmark, type CoachmarkProps } from "../../coachmark";

interface QuizCoachmarkProps {
onTourEnd: () => void;
}

export function QuizCoachmark({ onTourEnd }: QuizCoachmarkProps) {
const handleProgress: CoachmarkProps["callback"] = ({ type }) => {
if (type === EVENTS.TOUR_END) onTourEnd();
};

return (
<Coachmark
steps={STEPS}
continuous
showProgress
showSkipButton
callback={handleProgress}
/>
);
}

export const COACHMARK_TARGETS = {
GIT_GRAPH: "coach--git-graph",
KEY_COMMAND: "coach--key-command",
TERMINAL: "coach--terminal",
RESIZABLE: "coach--resizable",
};

const STEPS: CoachmarkProps["steps"] = [
{
title: "Git 그래프",
target: toClassSelector(COACHMARK_TARGETS.GIT_GRAPH),
content:
"현재 Git 상태에 따라 Git 그래프가 어떻게 변하는지 확인할 수 있어요.",
placement: "right",
disableBeacon: true, // autostart tour
},
{
title: "Git 핵심 명령어",
target: toClassSelector(COACHMARK_TARGETS.KEY_COMMAND),
content: "문제 풀이에 필요한 핵심 명령어를 확인할 수 있어요.",
placement: "bottom",
},
{
title: "문제 풀이용 터미널",
target: toClassSelector(COACHMARK_TARGETS.TERMINAL),
content: "터미널에 Git 명령어를 입력해 문제를 풀어보세요.",
placement: "top-start",
},
{
title: "터미널 리사이징",
target: toClassSelector(COACHMARK_TARGETS.RESIZABLE),
content: "위아래로 드래그해서 터미널 크기를 조절할 수 있어요.",
placement: "top",
},
];

function toClassSelector(className: string) {
return `.${className}`;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { COACHMARK_TARGETS, QuizCoachmark } from "./QuizCoachmark";
1 change: 1 addition & 0 deletions packages/frontend/src/components/quiz/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export { default as QuizLocation } from "./QuizLocation";
export { default as CommandAccordion } from "./CommandAccordion";
export { SolvedModal, useSolvedModal } from "./SolvedModal";
export { default as QuizAnswerModal } from "./QuizAnswerModal";
export { COACHMARK_TARGETS, QuizCoachmark } from "./QuizCoachmark";

0 comments on commit c9c43c1

Please sign in to comment.