-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from KingBoRam/feat/myprofile
✨ Feat: myprofile 수정 기능
- Loading branch information
Showing
23 changed files
with
465 additions
and
224 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
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,17 @@ | ||
import { Link } from 'react-router-dom'; | ||
|
||
interface FTILinkProps { | ||
ftiType: string | null; | ||
} | ||
|
||
export const FTILink: React.FC<FTILinkProps> = ({ ftiType }) => { | ||
return ftiType ? ( | ||
<p className="text-[1rem] font-medium">{ftiType}</p> | ||
) : ( | ||
<Link | ||
to={'/FTI'} | ||
className="mt-3 flex h-[52px] w-[33%] items-center justify-center rounded-lg bg-[#F5E3DB] text-[1rem] font-bold xs:h-[42px] xs:w-[40%] xs:text-[13px]"> | ||
FTI 설정하기 | ||
</Link> | ||
); | ||
}; |
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,10 @@ | ||
import { motion } from 'framer-motion'; | ||
|
||
export const LoadingSpinner = () => ( | ||
<motion.div | ||
className="absolute inset-0 flex items-center justify-center" | ||
animate={{ rotate: 360 }} | ||
transition={{ repeat: Infinity, duration: 1, ease: 'linear' }}> | ||
<div className="h-10 w-10 rounded-full border-4 border-primary border-t-transparent" /> | ||
</motion.div> | ||
); |
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,50 @@ | ||
import React from 'react'; | ||
import Button from '../../components/common/Button'; | ||
import { UseFormRegister } from 'react-hook-form'; | ||
|
||
interface ProfileFormProps { | ||
register: UseFormRegister<any>; | ||
duplicateNickname: string; | ||
handleNicknameBlur: (e: React.FocusEvent<HTMLInputElement>) => void; | ||
isLoading: boolean; | ||
} | ||
|
||
export const ProfileForm: React.FC<ProfileFormProps> = ({ | ||
register, | ||
duplicateNickname, | ||
handleNicknameBlur, | ||
isLoading, | ||
}) => { | ||
return ( | ||
<div className="m-[1rem]"> | ||
<label htmlFor="nickname" className="mb-2 block font-medium xs:text-[14px]"> | ||
닉네임 | ||
</label> | ||
<input | ||
id="nickname" | ||
type="text" | ||
className={`${duplicateNickname ? 'border-primary' : ''} h-[56px] w-full rounded-lg border py-[15px] pl-[15px] focus:border-gray-98 xs:h-[45px]`} | ||
{...register('nickname', { required: true })} | ||
onBlur={handleNicknameBlur} | ||
/> | ||
{duplicateNickname && <p className="ml-1 text-[12px] text-red">{duplicateNickname}</p>} | ||
<label htmlFor="introduce" className="mb-2 mt-5 block font-medium xs:mb-1 xs:mt-2 xs:text-[14px]"> | ||
내 소개 | ||
</label> | ||
<input | ||
id="introduce" | ||
type="text" | ||
className="h-[56px] w-full rounded-lg border py-[15px] pl-[15px] text-[#2D2C2C] focus:border-gray-98 xs:h-[45px]" | ||
{...register('introduce')} | ||
/> | ||
<Button | ||
type="submit" | ||
className={`mt-10 h-[56px] font-bold xs:mt-8 xs:h-[45px] ${isLoading ? 'cursor-not-allowed opacity-50' : ''}`} | ||
buttonSize="normal" | ||
bgColor="filled" | ||
disabled={duplicateNickname !== '' ? true : false}> | ||
저장하기 | ||
</Button> | ||
</div> | ||
); | ||
}; |
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,15 @@ | ||
import React from 'react'; | ||
|
||
interface ProfileImageInputProps { | ||
handleImageChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
} | ||
|
||
export const ProfileImageInput: React.FC<ProfileImageInputProps> = ({ handleImageChange }) => ( | ||
<> | ||
<input id="profileImg" type="file" accept="image/*" className="hidden" onChange={handleImageChange} /> | ||
<label | ||
htmlFor="profileImg" | ||
className="absolute bottom-2 right-2 h-[20%] w-[20%] cursor-pointer bg-[url('/images/edit_pencil.svg')] bg-cover xs:h-[30px] xs:w-[30px]" | ||
/> | ||
</> | ||
); |
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,36 @@ | ||
import React from 'react'; | ||
import { FTILink } from './FTILink'; | ||
import { LoadingSpinner } from './LoadingSpinner'; | ||
import { ProfileImageInput } from './ProfileImageInput'; | ||
|
||
interface ProfileImageSectionProps { | ||
profileImg: string; | ||
isLoading: boolean; | ||
handleImageChange: (e: React.ChangeEvent<HTMLInputElement>) => void; | ||
ftiType: string | null; | ||
} | ||
|
||
export const ProfileImageSection: React.FC<ProfileImageSectionProps> = ({ | ||
profileImg, | ||
isLoading, | ||
handleImageChange, | ||
ftiType, | ||
}) => { | ||
return ( | ||
<div className="flex h-[35%] flex-col items-center justify-evenly p-[1rem]"> | ||
<div className="relative mb-3 flex w-[30%] items-center justify-center pt-[30%] xs:w-[35%] xs:pt-[35%]"> | ||
{isLoading ? ( | ||
<LoadingSpinner /> | ||
) : ( | ||
<img | ||
className="absolute inset-0 h-full w-full rounded-full object-cover" | ||
src={profileImg} | ||
alt="프로필 이미지" | ||
/> | ||
)} | ||
<ProfileImageInput handleImageChange={handleImageChange} /> | ||
</div> | ||
<FTILink ftiType={ftiType} /> | ||
</div> | ||
); | ||
}; |
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
Oops, something went wrong.