"use client"; import Link from "next/link"; import { useEffect, useRef } from "react"; import { useGameStore } from "@/store/gameStore"; import type { ProblemCount } from "@/store/gameStore"; const problemCounts: ProblemCount[] = [5, 10]; export default function StartControls() { const startLinkRef = useRef(null); const selectedProblemCount = useGameStore( (state) => state.selectedProblemCount, ); const setProblemCount = useGameStore((state) => state.setProblemCount); const initSession = useGameStore((state) => state.initSession); useEffect(() => { startLinkRef.current?.focus(); }, []); return (
initSession(selectedProblemCount)} className="inline-flex h-12 items-center justify-center rounded-md bg-emerald-700 px-6 text-base font-semibold text-white transition hover:bg-emerald-800 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2" > 연습 시작
문제 수
{problemCounts.map((count) => { const selected = selectedProblemCount === count; return ( ); })}
); }