-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
프로필 수정 페이지 #257
Merged
프로필 수정 페이지 #257
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
f7a37c7
📝chore: cursor 스타일 추가
100Gyeon 8b52461
✨feat: 라우팅 관련 처리 (마이페이지에서 수정하기 버튼 누르면 프로필 수정 페이지로 이동하도록)
100Gyeon 682a48a
🎨design: 프로필 수정 페이지 퍼블리싱
100Gyeon 993d880
✨feat: 프로필 수정 바텀 시트 추가
100Gyeon 5a94c7e
🐛fix: 바텀 시트 영역 벗어나는 문제 해결
100Gyeon 9dd4837
🎨design: 퍼블리싱 보충
100Gyeon b2d3274
✨feat: 로그인된 유저 정보 띄우기
100Gyeon d462b66
🐛fix: 화면 넘치는 부분 수정
100Gyeon c4540f8
✨feat: My 키워드 페이지도 라우터에 추가
100Gyeon 0c73166
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon 8aeae28
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon 2107541
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon 6050ff2
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon 8c3d224
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon e37318b
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon 280ec76
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon 431c863
📝chore: 연필 아이콘 추가
100Gyeon e378cc0
Merge branch 'dev' of https://github.com/Neogasogaeseo/Naega-Web into…
100Gyeon d32c9e9
📝chore: Common 들어간 부분 지우기
100Gyeon 1d5c279
🎨design: input 스타일링
100Gyeon 5fffa18
📝chore: 인풋 스타일링 디테일 수정
100Gyeon 49c749b
📝chore: 가입, 프로필 수정에서 공통 속성으로 사용하기 위해 join이라는 단어 제거
100Gyeon edd9990
✨feat: input 조건 검사 추가
100Gyeon e74b4b6
✨feat: 수정 완료 시 토스트 띄우기
100Gyeon 13dd6f7
💅🏻style: import 구문 순서 변경
100Gyeon f482b24
🎨design: 마이페이지에서 키워드 전체보기로 이동하는 부분 추가
100Gyeon 2d3d9da
🔨refactor: 코드 리뷰 반영 (Edit 제거)
100Gyeon 29f9886
🔨refactor: 라우터 깔끔하게 정리
100Gyeon 4a32860
🔨refactor: 코드 리뷰 반영
100Gyeon c706862
📝chore: ProfileEdit에서 MyPageEdit으로 수정
100Gyeon a3cf4b0
🔨refactor: 코드 리뷰 반영 (useEffect 쪼개기, 조건 검사하는 부분 수정)
100Gyeon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
36 changes: 36 additions & 0 deletions
36
src/presentation/components/common/BottomSheet/MyPageEdit/index.tsx
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 { useNavigate } from 'react-router-dom'; | ||
|
||
import BottomSheet from '..'; | ||
import { icEdit } from '@assets/icons'; | ||
|
||
type MyPageEditBottomSheetProps = { | ||
isOpened: boolean; | ||
closeBottomSheet: () => void; | ||
type: string; | ||
userID?: string; | ||
}; | ||
|
||
function MyPageEditBottomSheet(props: MyPageEditBottomSheetProps) { | ||
const { isOpened, closeBottomSheet, type, userID } = props; | ||
const navigate = useNavigate(); | ||
|
||
const navigateToEditPage = () => { | ||
navigate(`/edit/${type}/${userID}`); | ||
}; | ||
|
||
return ( | ||
<BottomSheet | ||
buttonList={[ | ||
{ | ||
icon: icEdit, | ||
label: '수정하기', | ||
onClick: navigateToEditPage, | ||
}, | ||
]} | ||
closeBottomSheet={closeBottomSheet} | ||
isOpened={isOpened} | ||
/> | ||
); | ||
} | ||
|
||
export default MyPageEditBottomSheet; |
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,23 @@ | ||
import { useParams } from 'react-router-dom'; | ||
|
||
import CommonNavigation from '@components/common/Navigation'; | ||
import { StMyKeywordDelete, StMyKeywordHeader } from './style'; | ||
|
||
function MyKeywordDelete() { | ||
const { userID } = useParams(); | ||
|
||
if (!userID) return <></>; | ||
|
||
return ( | ||
<> | ||
<CommonNavigation title="My 키워드" /> | ||
<StMyKeywordDelete> | ||
<StMyKeywordHeader> | ||
<span>My 키워드</span> | ||
</StMyKeywordHeader> | ||
</StMyKeywordDelete> | ||
</> | ||
); | ||
} | ||
|
||
export default MyKeywordDelete; |
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,14 @@ | ||
import styled from 'styled-components'; | ||
|
||
import { COLOR } from '@styles/common/color'; | ||
|
||
export const StMyKeywordDelete = styled.div``; | ||
|
||
export const StMyKeywordHeader = styled.div` | ||
height: 76px; | ||
background-color: ${COLOR.GRAY_1}; | ||
padding: 42px 20px 19px 24px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
`; |
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,111 @@ | ||
import React, { useEffect, useState } from 'react'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { useToast } from '@hooks/useToast'; | ||
import { useLoginUser } from '@hooks/useLoginUser'; | ||
import CommonInput from '@components/common/Input'; | ||
import CommonLabel from '@components/common/Label'; | ||
import CommonNavigation from '@components/common/Navigation'; | ||
import FileUpload from '@components/common/FileUpload'; | ||
import { StInputWrapper, StMyProfileEdit, StProfileImg } from './style'; | ||
import { IcMypageEdit } from '@assets/icons'; | ||
import { imgEmptyProfile } from '@assets/images'; | ||
|
||
function MyProfileEdit() { | ||
const navigate = useNavigate(); | ||
const { fireToast } = useToast(); | ||
const { username, userID, profileImage } = useLoginUser(); | ||
const [image, setImage] = useState<File | null>(null); | ||
const [inputId, setInputId] = useState(''); | ||
const [inputName, setInputName] = useState(''); | ||
const [errorMsg, setErrorMsg] = useState(''); | ||
const [isEditConditionPassed, setIsEditConditionPassed] = useState({ | ||
id: false, | ||
name: false, | ||
}); | ||
|
||
useEffect(() => { | ||
const idCheck = /^[a-z]+[a-z|0-9|.|_]{4,15}$/; | ||
setIsEditConditionPassed({ | ||
...isEditConditionPassed, | ||
id: idCheck.test(inputId), | ||
}); | ||
|
||
if (!idCheck.test(inputId)) { | ||
setErrorMsg('*영문 소문자, 숫자, 특수문자(._) 4~15자 이내'); | ||
} | ||
|
||
if (!/^[a-z]/.test(inputId)) { | ||
setErrorMsg('*아이디의 첫 글자는 영문 소문자'); | ||
} | ||
}, [inputId]); | ||
|
||
useEffect(() => { | ||
setIsEditConditionPassed({ | ||
...isEditConditionPassed, | ||
name: inputName !== '', | ||
}); | ||
}, [inputName]); | ||
|
||
const editProfile = (e: React.MouseEvent<HTMLButtonElement>) => { | ||
e.preventDefault(); | ||
try { | ||
const form = new FormData(); | ||
form.append('profileId', inputId); | ||
form.append('name', inputName); | ||
image && form.append('image', image); | ||
// 나중에 여기 put 추가할 예정 | ||
fireToast({ content: '수정 완료' }); | ||
} catch (error) { | ||
console.error(error); | ||
navigate('/'); | ||
} | ||
}; | ||
|
||
return ( | ||
<> | ||
<CommonNavigation title="프로필 수정" /> | ||
<StMyProfileEdit> | ||
<StProfileImg> | ||
<FileUpload width="118px" height="118px" setFile={setImage} borderRadius="50%"> | ||
<> | ||
<img src={profileImage || imgEmptyProfile} /> | ||
<IcMypageEdit /> | ||
</> | ||
</FileUpload> | ||
</StProfileImg> | ||
<StInputWrapper> | ||
<CommonLabel content="아이디" marginTop="52px" marginBottom="20px" /> | ||
<CommonInput | ||
width="100%" | ||
isConditionPassed={isEditConditionPassed.id} | ||
onChange={(value) => { | ||
setInputId(value); | ||
}} | ||
errorMsg={errorMsg} | ||
placeholder={userID} | ||
maxLength={15} | ||
/> | ||
<CommonLabel content="이름" marginTop="46px" marginBottom="20px" /> | ||
<CommonInput | ||
width="100%" | ||
isConditionPassed={isEditConditionPassed.name} | ||
onChange={(value) => { | ||
setInputName(value); | ||
}} | ||
errorMsg={errorMsg} | ||
placeholder={username} | ||
/> | ||
</StInputWrapper> | ||
<button | ||
onClick={editProfile} | ||
disabled={!Object.values(isEditConditionPassed).every((condition) => condition === true)} | ||
> | ||
완료 | ||
</button> | ||
</StMyProfileEdit> | ||
</> | ||
); | ||
} | ||
|
||
export default MyProfileEdit; |
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,74 @@ | ||
import styled from 'styled-components'; | ||
|
||
import { CORAL_MAIN_BUTTON } from '@styles/common/button'; | ||
import { COLOR } from '@styles/common/color'; | ||
import { FONT_STYLES } from '@styles/common/font-style'; | ||
import { icEmail, icInputPencil } from '@assets/icons'; | ||
|
||
export const StMyProfileEdit = styled.div` | ||
padding: 0 20px; | ||
|
||
& > div > button { | ||
display: block; | ||
margin: 0 auto; | ||
margin-top: 52px; | ||
} | ||
|
||
& > button { | ||
width: 100%; | ||
border-radius: 16px; | ||
padding: 20px 0; | ||
margin-top: 178px; | ||
margin-bottom: 48px; | ||
${FONT_STYLES.M_16_TITLE}; | ||
color: ${COLOR.WHITE}; | ||
background-color: ${COLOR.GRAY_3}; | ||
|
||
:not(:disabled) { | ||
${CORAL_MAIN_BUTTON}; | ||
} | ||
} | ||
`; | ||
|
||
export const StProfileImg = styled.div` | ||
position: relative; | ||
width: fit-content; | ||
margin: 0 auto; | ||
margin-top: 52px; | ||
|
||
img { | ||
width: 118px; | ||
height: 118px; | ||
border-radius: 50%; | ||
} | ||
|
||
svg { | ||
position: absolute; | ||
bottom: 0; | ||
right: 0; | ||
width: 32.29px; | ||
height: 32.29px; | ||
} | ||
`; | ||
|
||
const iconEmail = icEmail; | ||
const iconInputPencil = icInputPencil; | ||
|
||
export const StInputWrapper = styled.div` | ||
& > div:nth-of-type(2n + 1) { | ||
margin-left: 4px; | ||
} | ||
|
||
& div:nth-child(2) > form > input { | ||
background-image: url(${iconEmail}), url(${iconInputPencil}); | ||
background-position: 12px, calc(100% - 20px); | ||
background-repeat: no-repeat, no-repeat; | ||
padding-left: 36px; | ||
} | ||
|
||
& div:last-child > form > input { | ||
background-image: url(${iconInputPencil}); | ||
background-position: calc(100% - 20px); | ||
background-repeat: no-repeat; | ||
} | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
요 사이에 키워드 리스트 와야 할 것 같은데 혹시 아직 안한 건지 제가 잘못 이해한건지 궁금합니다!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
제대로 이해한 거 맞고 아직 미완입니다 !!
바텀시트에서 다른 링크로 넘어가는 부분까지 넣고 싶어서 페이지 윗부분만 살짝 만들었어요
남은 부분은 다음 PR에 올릴게유 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
넴💟💟