refactoring ui into separate components, updating ui, adding color scheme

This commit is contained in:
lila 2026-04-11 20:53:10 +02:00
parent ea33b7fcc8
commit b7b1cd383f
4 changed files with 184 additions and 55 deletions

View file

@ -0,0 +1,27 @@
type OptionButtonProps = {
text: string;
state: "idle" | "disabled" | "correct" | "wrong";
onSelect: () => void;
};
export const OptionButton = ({ text, state, onSelect }: OptionButtonProps) => {
const base =
"w-full py-3 px-6 rounded-2xl text-lg font-semibold transition-all duration-200 border-b-4 cursor-pointer";
const styles = {
idle: "bg-white text-purple-900 border-purple-200 hover:bg-purple-50 hover:border-purple-300 hover:-translate-y-0.5 active:translate-y-0 active:border-b-2",
disabled: "bg-gray-100 text-gray-400 border-gray-200 cursor-default",
correct: "bg-emerald-400 text-white border-emerald-600 scale-[1.02]",
wrong: "bg-pink-400 text-white border-pink-600",
};
return (
<button
className={`${base} ${styles[state]}`}
onClick={onSelect}
disabled={state !== "idle"}
>
{text}
</button>
);
};