Skip to content

Commit

Permalink
refactor: 정답 모달 > 상수화 및 삼항 연산자 대신 && 로 변경
Browse files Browse the repository at this point in the history
[#2]
  • Loading branch information
YuHyun-P authored and flydog98 committed Dec 14, 2023
1 parent 1b12eb2 commit 1349840
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { Button, Modal, toast } from "../../../design-system/components/common";

import * as styles from "./SolvedModal.css";

const VISIBLE = "visible";

interface SolvedModalProps {
link: string;
lastQuiz: boolean;
Expand All @@ -29,10 +31,10 @@ export function SolvedModal({
const handleCopy = async () => {
try {
await navigator.clipboard.writeText(link);
copyButtonRef.current?.classList.add("visible");
copyButtonRef.current?.classList.add(VISIBLE);

setTimeout(() => {
copyButtonRef.current?.classList.remove("visible");
copyButtonRef.current?.classList.remove(VISIBLE);
}, 2000);
} catch (error) {
toast.error("링크 복사를 실패했습니다. 잠시 후 다시 시도해 주세요.");
Expand Down Expand Up @@ -64,11 +66,11 @@ export function SolvedModal({
<Button full variant="primaryLow" onClick={handleShowAnswer}>
내 답안 보러가기
</Button>
{!lastQuiz ? (
{!lastQuiz && (
<Button full variant="primaryFill" onClick={onNextQuiz}>
다음 문제 풀래요
</Button>
) : null}
)}
</div>
</div>
</Modal>
Expand Down

0 comments on commit 1349840

Please sign in to comment.