"use client"; import Link from "next/link"; import { useEffect, useRef } from "react"; export type PreparationProblemCount = 5 | 10; export type PreparationMaxTermCount = 2 | 3 | 4; interface ParenthesesPreparationClientProps { eyebrow: string; title: string; description: string; notice: string; playHref: string; selectedProblemCount: PreparationProblemCount; selectedMaxTermCount: PreparationMaxTermCount; onProblemCountChange: (count: PreparationProblemCount) => void; onMaxTermCountChange: (count: PreparationMaxTermCount) => void; onStart: () => void; } const problemCounts: PreparationProblemCount[] = [5, 10]; const maxTermCounts: PreparationMaxTermCount[] = [2, 3, 4]; const buttonGroupClassName = "inline-flex gap-1 rounded-md border border-slate-300 bg-white p-1 shadow-sm"; function optionButtonClassName({ selected, disabled = false, }: { selected: boolean; disabled?: boolean; }) { return `h-10 min-w-16 rounded px-4 text-base font-semibold transition focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2 ${ selected ? "bg-emerald-700 text-white" : "text-slate-700 hover:bg-slate-100" } ${ disabled ? "cursor-not-allowed bg-slate-100 text-slate-400 hover:bg-slate-100" : "" }`; } const bracketKinds = [ { label: "( )", name: "소괄호", selected: true, disabled: false, }, { label: "{ }", name: "중괄호", selected: false, disabled: true, }, { label: "[ ]", name: "대괄호", selected: false, disabled: true, }, ]; export default function ParenthesesPreparationClient({ eyebrow, title, description, notice, playHref, selectedProblemCount, selectedMaxTermCount, onProblemCountChange, onMaxTermCountChange, onStart, }: ParenthesesPreparationClientProps) { const startLinkRef = useRef(null); useEffect(() => { startLinkRef.current?.focus(); }, []); return (

{eyebrow}

{title}

{description}

문제 수
{problemCounts.map((count) => { const selected = selectedProblemCount === count; return ( ); })}
괄호 종류
{bracketKinds.map((bracketKind) => ( ))}
괄호 안 최대 항 수
{maxTermCounts.map((count) => { const selected = selectedMaxTermCount === count; return ( ); })}
연습 시작 뒤로가기

{notice}

); }