-
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.
Merge pull request #134 from Donggrina/refactor/image-upload
Refactor: 이미지 업로드 로직 수정(모달 수정하고 머지하겠습니다)
- Loading branch information
Showing
9 changed files
with
131 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
.modalContainer { | ||
position: relative; | ||
width: 100%; | ||
p { | ||
padding: 61px 47px 47px; | ||
text-align: center; | ||
} | ||
.buttonBox { | ||
display: flex; | ||
height: 64px; | ||
border-top: 1px solid var(--main-color); | ||
width: 100%; | ||
} | ||
.modalCloseButton { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
position: absolute; | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 50%; | ||
background-color: var(--main-color); | ||
bottom: -68px; | ||
left: 50%; | ||
transform: translateX(-50%); | ||
box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.15); | ||
} | ||
} |
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,45 @@ | ||
import { PropsWithChildren, ReactNode, RefObject } from 'react'; | ||
import styles from './image-modal.module.scss'; | ||
import Button from '@/components/common/button/button'; | ||
import CloseSVG from '@/public/images/pets/plus-circle.svg'; | ||
import { ControllerRenderProps, FieldValues } from 'react-hook-form'; | ||
|
||
interface ImageModalType { | ||
Modal: ({ children }: PropsWithChildren) => ReactNode; | ||
handleModal: (isOpen: boolean) => void; | ||
fileInputRef: RefObject<HTMLInputElement>; | ||
field: ControllerRenderProps<FieldValues, string>; | ||
} | ||
|
||
export default function ImageModal({ Modal, handleModal, fileInputRef, field }: ImageModalType) { | ||
const handleClose = () => { | ||
handleModal(false); | ||
}; | ||
const handleButtonClick = () => { | ||
if (fileInputRef.current) { | ||
fileInputRef.current.click(); | ||
} | ||
}; | ||
const handleInitialization = () => { | ||
field.onChange(null); | ||
handleModal(false); | ||
}; | ||
return ( | ||
<Modal> | ||
<div className={styles.modalContainer}> | ||
<p>프로필 사진을 변경하시겠습니까?</p> | ||
<div className={styles.buttonBox}> | ||
<Button type="button" className="default" onClick={handleInitialization} leftRound> | ||
이미지 초기화 하기 | ||
</Button> | ||
<Button type="button" className="primary" onClick={handleButtonClick} rightRound> | ||
이미지 변경하기 | ||
</Button> | ||
</div> | ||
<button className={styles.modalCloseButton} onClick={handleClose} type="button" title="모달 닫기"> | ||
<CloseSVG /> | ||
</button> | ||
</div> | ||
</Modal> | ||
); | ||
} |
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
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