diff --git a/fe/src/app/components/common/Button.tsx b/fe/src/app/components/common/Button.tsx index 306602a..d31a4a7 100644 --- a/fe/src/app/components/common/Button.tsx +++ b/fe/src/app/components/common/Button.tsx @@ -1,6 +1,6 @@ "use client"; -import React from "react"; +import React, { useState } from "react"; export interface ButtonProps { label: string; @@ -8,6 +8,8 @@ export interface ButtonProps { type?: "start" | "next" | "submit" | "default"; className?: string; disabled?: boolean; + isSubmitting?: boolean; + isFormComplete?: boolean; } function Button({ @@ -16,17 +18,49 @@ function Button({ type = "default", className = "", disabled = false, + isSubmitting = false, + isFormComplete = true, }: ButtonProps) { + const [isActive, setIsActive] = useState(false); + const [isClicked, setIsClicked] = useState(false); + + const handleClick = () => { + setIsActive(true); + setIsClicked(true); + onClick(); + }; + const getButtonStyle = () => { - if (disabled) { - return "bg-[#E4E4E4] text-[#8E8E8E] cursor-not-allowed"; + if (isSubmitting) { + return "bg-[#000000] text-white cursor-not-allowed"; } + + if (!isFormComplete) { + return "bg-[#E4E4E4] cursor-not-allowed text-[#8E8E8E]"; + } + + if (isClicked && type !== "start") { + return "bg-[#000000] text-white"; + } + + if (isActive) { + switch (type) { + case "start": + return "bg-[#A6251B] text-white"; + case "next": + case "submit": + case "default": + default: + return "bg-[#1D1D1D] text-white"; + } + } + switch (type) { case "start": return "bg-[#F73A2C] text-white"; case "next": case "submit": - return "bg-[#1D1D1D] text-white"; + case "default": default: return "bg-[#1D1D1D] text-white"; } @@ -36,9 +70,9 @@ function Button({