"use client";
import { cn } from "@/lib/utils";
interface FractionInputProps {
numerator: string;
denominator: string;
onNumeratorChange: (value: string) => void;
onDenominatorChange: (value: string) => void;
disabled?: boolean;
className?: string;
}
export function FractionInput({
numerator,
denominator,
onNumeratorChange,
onDenominatorChange,
disabled = false,
className,
}: FractionInputProps) {
return (
);
}
interface DecimalInputProps {
value: string;
onChange: (value: string) => void;
disabled?: boolean;
className?: string;
}
export function DecimalInput({ value, onChange, disabled, className }: DecimalInputProps) {
return (
onChange(e.target.value)}
disabled={disabled}
className={cn(
"w-28 rounded-lg border border-border bg-surface px-3 py-2 text-center text-lg font-bold focus:border-unit-2 focus:outline-none",
className,
)}
placeholder="?"
aria-label="Answer"
/>
);
}
interface RatioInputProps {
parts: string[];
onChange: (index: number, value: string) => void;
disabled?: boolean;
className?: string;
}
export function RatioInput({ parts, onChange, disabled, className }: RatioInputProps) {
return (
{parts.map((p, i) => (
{i > 0 && :}
onChange(i, e.target.value)}
disabled={disabled}
className="w-14 rounded-lg border border-border bg-surface px-2 py-2 text-center text-lg font-bold focus:border-unit-4 focus:outline-none"
placeholder="?"
aria-label={`Part ${i + 1}`}
/>
))}
);
}