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({
{showExitModal && ( - + )} ); diff --git "a/fe/src/app/event-maps/[id]/load-mappin/forms/links/\bcomponents/LinkField.tsx" "b/fe/src/app/event-maps/[id]/load-mappin/forms/links/\bcomponents/LinkField.tsx" index 1ac557d..e244ed7 100644 --- "a/fe/src/app/event-maps/[id]/load-mappin/forms/links/\bcomponents/LinkField.tsx" +++ "b/fe/src/app/event-maps/[id]/load-mappin/forms/links/\bcomponents/LinkField.tsx" @@ -5,11 +5,13 @@ import { nanoid } from "nanoid"; import Image from "next/image"; import { useRouter, useParams } from "next/navigation"; -interface LinkFieldEditProps { +interface LinkFieldProps { label: string; placeholder: string; value: string[]; onChange: (value: string[]) => void; + showTooltip?: boolean; + onInfoClick?: () => void; } interface InputField { @@ -18,14 +20,15 @@ interface InputField { error: string; isValid: boolean; isTyping: boolean; + canEdit: boolean; } -export default function LinkFieldEdit({ +export default function LinkField({ label, placeholder, value, onChange, -}: LinkFieldEditProps) { +}: LinkFieldProps) { const [inputFields, setInputFields] = useState( value.length > 0 ? value.map((val) => ({ @@ -34,6 +37,7 @@ export default function LinkFieldEdit({ error: "", isValid: true, isTyping: false, + canEdit: true, })) : [ { @@ -42,6 +46,7 @@ export default function LinkFieldEdit({ error: "", isValid: false, isTyping: false, + canEdit: true, }, ] ); @@ -57,11 +62,6 @@ export default function LinkFieldEdit({ onChange(validLinks); }, [inputFields, onChange]); - const cleanURL = (url: string): string => { - const match = url.match(/https?:\/\/[^\s]+/); - return match ? match[0].trim() : ""; - }; - const validateLink = async (fieldId: string, url: string, type: string) => { const endpoint = type === "북마크 공유 링크" ? "/pings/bookmark" : "/pings/store"; @@ -113,17 +113,16 @@ export default function LinkFieldEdit({ const handlePasteFromClipboard = async (fieldId: string) => { try { const clipboardText = await navigator.clipboard.readText(); - const cleanedValue = cleanURL(clipboardText); - if (cleanedValue) { + if (clipboardText.trim()) { setInputFields((prevFields) => prevFields.map((fieldItem) => fieldItem.id === fieldId - ? { ...fieldItem, text: cleanedValue, isValid: false } + ? { ...fieldItem, text: clipboardText, isValid: false } : fieldItem ) ); - validateLink(fieldId, cleanedValue, label); + validateLink(fieldId, clipboardText, label); } } catch (error) { console.error("클립보드에서 텍스트를 읽는 데 실패했습니다:", error); @@ -131,18 +130,15 @@ export default function LinkFieldEdit({ }; const handleInputChange = (fieldId: string, inputValue: string) => { - const cleanedValue = cleanURL(inputValue); // URL 정리 setInputFields((prevFields) => prevFields.map((fieldItem) => fieldItem.id === fieldId - ? { ...fieldItem, text: cleanedValue, isValid: false, isTyping: true } + ? { ...fieldItem, text: inputValue, isValid: false, isTyping: true } : fieldItem ) ); - if (cleanedValue) { - validateLink(fieldId, cleanedValue, label); - } + validateLink(fieldId, inputValue, label); }; const handleFocus = (fieldId: string) => { @@ -172,6 +168,7 @@ export default function LinkFieldEdit({ error: "", isValid: false, isTyping: false, + canEdit: true, }, ]); }; @@ -248,9 +245,7 @@ export default function LinkFieldEdit({ {inputFields.map((item, index) => (
- {/* 체크박스 */}
@@ -125,7 +124,6 @@ export default function LinksPage() {
- {/* 하단 버튼 */}
diff --git a/fe/src/app/eventcreate-page/page.tsx b/fe/src/app/eventcreate-page/page.tsx index eedf5f4..b68ad4e 100644 --- a/fe/src/app/eventcreate-page/page.tsx +++ b/fe/src/app/eventcreate-page/page.tsx @@ -74,12 +74,8 @@ function EventCreatePage() { label="다음" type="next" onClick={handleNextClick} - className={`w-[328px] h-[60px] py-[17px] rounded-lg text-lg font-['Pretendard'] font-medium ${ - isFormComplete && !isSubmitting - ? "bg-black text-white" - : "bg-[#E4E4E4] text-[#8E8E8E]" - }`} disabled={!isFormComplete || isSubmitting} + isSubmitting={isSubmitting} />
diff --git a/fe/src/app/page.tsx b/fe/src/app/page.tsx index 83e3e2e..1c6648d 100644 --- a/fe/src/app/page.tsx +++ b/fe/src/app/page.tsx @@ -13,7 +13,7 @@ function LoadingPage() { }; return ( -
+