-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
390 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from "react"; | ||
|
||
interface ExitModalProps { | ||
onCancel: () => void; | ||
onExit: () => void; | ||
} | ||
|
||
function ExitModal({ onCancel, onExit }: ExitModalProps) { | ||
return ( | ||
<div className="w-[272px] h-[202px] flex flex-col items-center inline-flex bg-gray-500 bg-opacity-50 rounded-lg"> | ||
<div className="w-full h-[148px] px-[39px] pt-9 pb-7 bg-white rounded-tl-xl rounded-tr-xl flex flex-col items-center gap-2.5"> | ||
<div className="w-full h-[84px] flex flex-col items-center gap-2"> | ||
<div className="w-full text-center text-[#1d1d1d] text-xl font-semibold font-['Pretendard'] leading-7"> | ||
저장하지 않고 나갈까요? | ||
</div> | ||
<div className="text-center text-[#8e8e8e] text-base font-medium font-['Pretendard'] leading-normal"> | ||
이대로 나가면 | ||
<br /> 작성하던 내용이 사라져요 | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div className="w-full flex"> | ||
<button | ||
type="button" | ||
onClick={onCancel} | ||
className="w-1/2 h-[54px] bg-[#f0f0f0] rounded-bl-xl flex items-center justify-center" | ||
> | ||
<span className="text-center text-[#2c2c2c] text-lg font-medium font-['Pretendard'] leading-relaxed"> | ||
취소 | ||
</span> | ||
</button> | ||
|
||
<button | ||
type="button" | ||
onClick={onExit} | ||
className="w-1/2 h-[54px] bg-[#1d1d1d] rounded-br-xl flex items-center justify-center" | ||
> | ||
<span className="text-center text-white text-lg font-medium font-['Pretendard'] leading-relaxed"> | ||
나가기 | ||
</span> | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
} | ||
export default ExitModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
"use client"; | ||
|
||
import React, { useState, useEffect, FormEvent } from "react"; | ||
import LinkField from "./LinkField"; | ||
|
||
interface FormProps { | ||
userName: string; | ||
} | ||
|
||
export default function Form({ userName }: FormProps) { | ||
const [mapLinks, setMapLinks] = useState([""]); | ||
const [storeLinks, setStoreLinks] = useState([""]); | ||
const [isTooltipVisible, setIsTooltipVisible] = useState(true); | ||
const [isFormComplete, setIsFormComplete] = useState(false); // isFormComplete 추가 | ||
|
||
// mapLinks와 storeLinks가 모두 입력되었을 때만 isFormComplete를 true로 설정 | ||
useEffect(() => { | ||
setIsFormComplete( | ||
mapLinks.some((link) => link.trim() !== "") && | ||
storeLinks.some((link) => link.trim() !== "") | ||
); | ||
}, [mapLinks, storeLinks]); | ||
|
||
const handleSubmit = (e: FormEvent) => { | ||
e.preventDefault(); | ||
const formData = { | ||
userName, | ||
mapLinks, | ||
storeLinks, | ||
}; | ||
console.log("폼 데이터:", formData); | ||
}; | ||
|
||
return ( | ||
<div className="px-4"> | ||
<form onSubmit={handleSubmit}> | ||
<LinkField | ||
label="맵핀 모음 링크" | ||
placeholder="링크 붙여넣기" | ||
value={mapLinks} | ||
onChange={setMapLinks} | ||
showTooltip={isTooltipVisible} | ||
onInfoClick={() => setIsTooltipVisible(true)} | ||
/> | ||
|
||
<LinkField | ||
label="가게 정보 링크" | ||
placeholder="링크 붙여넣기" | ||
value={storeLinks} | ||
onChange={setStoreLinks} | ||
/> | ||
|
||
<button | ||
className={`w-full flex items-center text-lg font-200 justify-center h-[60px] rounded-small ${ | ||
isFormComplete | ||
? "bg-grayscale-90 text-white" | ||
: "bg-grayscale-20 text-mediumGray" | ||
}`} | ||
type="submit" | ||
disabled={!isFormComplete} | ||
> | ||
확인 | ||
</button> | ||
</form> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.