Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/common/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import Down from '@/assets/icons/dropdown.svg';

interface DropdownProps<T extends string> {
options: readonly T[];
selected: T;
setSelect: Dispatch<SetStateAction<T>>; // Dispatch<SetStateAction<T>>는 set함수 타입
selected: T | null;
setSelect: Dispatch<SetStateAction<T | null>>; // Dispatch<SetStateAction<T>>는 set함수 타입
placeholder?: string;
variant: 'form' | 'filter';
id?: string;
Expand Down
103 changes: 52 additions & 51 deletions src/pages/profile/ProfileForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default function ProfileForm() {
});

// dropdown 컴포넌트에 set함수를 전달하기 위해 address는 따로 분리
const [selectedAddress, setSelectedAddress] = useState<SeoulDistrict | ''>(
'',
const [selectedAddress, setSelectedAddress] = useState<SeoulDistrict | null>(
null,
);

const [modal, setModal] = useState({
Expand Down Expand Up @@ -61,7 +61,7 @@ export default function ProfileForm() {
} else {
setModal({
isOpen: true,
message: '로그인 먼저 해주세요.',
message: '로그인이 필요합니다.',
});
}
}, [isLoggedIn]);
Expand All @@ -86,7 +86,7 @@ export default function ProfileForm() {
if (!isLoggedIn || !userId) {
setModal({
isOpen: true,
message: '로그인 먼저 해주세요.',
message: '로그인이 필요합니다.',
});
return;
}
Expand Down Expand Up @@ -141,61 +141,62 @@ export default function ProfileForm() {
}, [modal.message, navigate]);

return (
<div className="min-h-screen bg-gray-5">
<form
className="mx-12 flex flex-col gap-24 pt-40 pb-80 md:mx-32 md:gap-32 md:py-60 lg:mx-auto lg:w-964"
onSubmit={handleSubmit}
>
<div className="min-h-[calc(100vh-102px)] bg-gray-5 md:min-h-[calc(100vh-70px)]">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

별로 좋은 방식은 아닌 것 같지만... 일단 확인했습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

혹시 어떤 방식이 또 있을까요?? 전 저거밖에 생각이 안나서 저렇게 작성했습니다

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

저도 마땅히 떠오르진 않네요? 초기에 말한 것처럼 Nav 컴포넌트를 page 컴포넌트 내에 넣고 h-screen으로 활용하는 게 제일 좋지 않나 생각하지만 일단 밖으로 빼서 더 좋은 방법이 생각 나지는 않네요

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

으흠 알겠습니다 일단 이렇게 가겠습니다~!

<div className="mx-12 flex flex-col gap-24 pt-40 pb-80 md:mx-32 md:gap-32 md:py-60 lg:mx-auto lg:w-964">
<div className="flex items-center justify-between">
<h1 className="text-h3 font-bold md:text-h1">내 프로필</h1>
<h1 className="text-h3/24 font-bold md:text-h1/34">내 프로필</h1>
<Link to="/profile">
<img src={close} alt="닫기" className="md:size-32" />
</Link>
</div>
<div className="flex flex-col gap-20 md:gap-24">
<div className="grid grid-cols-1 gap-20 md:grid-cols-2 md:gap-y-24 lg:grid-cols-3">
<Input
label="이름*"
name="name"
value={profileInfo.name}
onChange={handleChange}
/>
<Input
label="연락처*"
type="tel"
name="phone"
maxLength={11}
value={profileInfo.phone}
onChange={handleChange}
/>
<div className="flex flex-col gap-8 text-body1/26 font-regular">
<label htmlFor="region">선호 지역*</label>
<Dropdown
id="region"
variant="form"
options={ADDRESS_OPTIONS}
selected={selectedAddress}
setSelect={setSelectedAddress}
<form
className="flex flex-col gap-24 md:gap-32"
onSubmit={handleSubmit}
>
<div className="flex flex-col gap-20 md:gap-24">
<div className="grid grid-cols-1 gap-20 md:grid-cols-2 md:gap-y-24 lg:grid-cols-3">
<Input
label="이름*"
name="name"
value={profileInfo.name}
onChange={handleChange}
/>
<Input
label="연락처*"
type="tel"
name="phone"
maxLength={11}
value={profileInfo.phone}
onChange={handleChange}
/>
<div className="flex flex-col gap-8 text-body1/26 font-regular">
<label htmlFor="region">선호 지역*</label>
<Dropdown
id="region"
variant="form"
options={ADDRESS_OPTIONS}
selected={selectedAddress}
setSelect={setSelectedAddress}
/>
</div>
</div>
<div className="flex flex-col gap-8 text-body1/26 font-regular">
<label htmlFor="bio">소개</label>
<textarea
name="bio"
id="bio"
className="h-153 resize-none rounded-[5px] border border-gray-30 bg-white px-20 py-16 placeholder-gray-40"
placeholder="입력"
value={profileInfo.bio}
onChange={handleChange}
></textarea>
</div>
</div>

<div className="flex flex-col gap-8 text-body1/26 font-regular">
<label htmlFor="bio">소개</label>
<textarea
name="bio"
id="bio"
className="h-153 resize-none rounded-[5px] border border-gray-30 bg-white px-20 py-16 placeholder-gray-40"
placeholder="입력"
value={profileInfo.bio}
onChange={handleChange}
></textarea>
</div>
</div>
<Button type="submit" className="md:mx-auto md:w-312">
등록하기
</Button>
</form>
<Button type="submit" className="md:mx-auto md:w-312">
등록하기
</Button>
</form>
</div>
{modal.isOpen && (
<Modal onClose={handleModalConfirm} onButtonClick={handleModalConfirm}>
{modal.message}
Expand Down