-
Notifications
You must be signed in to change notification settings - Fork 2
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
이미지 클릭 시 리뷰 모달 오픈 및 리뷰모달 글쓰기 모달 전체적인 스타일 변경 #364
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ interface ProgressiveImageProps { | |
width: number | "100%"; | ||
height: number | "100%"; | ||
alt: string; | ||
handleClickImage?: () => void; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. optional로 두신 부분이 좋네요! |
||
} | ||
|
||
const ProgressiveImage = ({ | ||
|
@@ -18,6 +19,7 @@ const ProgressiveImage = ({ | |
width, | ||
height, | ||
alt, | ||
handleClickImage, | ||
}: ProgressiveImageProps): JSX.Element => { | ||
const { observeImage } = useImageIntersect(); | ||
|
||
|
@@ -26,6 +28,7 @@ const ProgressiveImage = ({ | |
ref={observeImage} | ||
className={`progressive-image ${className}`} | ||
src={placeholder} | ||
onClick={handleClickImage} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. onClick에 undefined가 들어가도 상관없으려나요? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵 따로 값을 넣어주지 않으면 기본이 undefined인 것 같습니다. |
||
data-lazysrc={src} | ||
width={width} | ||
height={height} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
import React, { useCallback, MouseEvent } from "react"; | ||
import CloseIcon from "@mui/icons-material/Close"; | ||
|
||
import ModalContainer from "@/components/main/Modal/ModalContainer/ModalContainer"; | ||
import useCommonModalStore from "@/store/useCommonModalStore"; | ||
import { isCloseModalElement } from "@/utils/dom"; | ||
|
||
import "./ModalWrapper.scss"; | ||
|
||
|
@@ -12,16 +14,22 @@ const CommonModalWrapper = (): JSX.Element => { | |
]); | ||
|
||
const clickWrapperBackGround = useCallback( | ||
(e: MouseEvent<HTMLDivElement>) => { | ||
(e: MouseEvent<HTMLDivElement | SVGSVGElement>) => { | ||
if (!isCloseModalElement(e.target as HTMLElement)) return; | ||
closeModal(); | ||
}, | ||
[] | ||
); | ||
|
||
return modalContent !== null ? ( | ||
<> | ||
<div className="modal-background" onClick={clickWrapperBackGround} /> | ||
<ModalContainer content={modalContent} /> | ||
<div className="modal-background" onClick={clickWrapperBackGround}> | ||
<CloseIcon | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 닫는 아이콘을 추가하셨군요! |
||
className="modal-close-button" | ||
onClick={clickWrapperBackGround} | ||
/> | ||
<ModalContainer content={modalContent} /> | ||
</div> | ||
</> | ||
) : ( | ||
<></> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,26 @@ | ||
@import "@/styles/_global-style.scss"; | ||
@import "@/styles/theme.scss"; | ||
@import "@/styles/responsive"; | ||
|
||
.modal-background { | ||
position: absolute; | ||
top: 0; | ||
z-index: $modal-background-z-index !important; | ||
display: flex; | ||
align-items: center; | ||
width: 100vw; | ||
height: 100vh; | ||
min-height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.75); | ||
} | ||
|
||
.modal-close-button { | ||
position: absolute; | ||
top: 2rem; | ||
right: 2rem; | ||
z-index: $modal-content-z-index; | ||
font-size: 2rem; | ||
color: $line-color; | ||
cursor: pointer; | ||
transform: scale(2); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,7 @@ | |
gap: 1rem; | ||
width: 100%; | ||
height: 100%; | ||
@media screen and (max-width: 720px) { | ||
flex-direction: column; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
&--image { | ||
width: inherit; | ||
height: inherit; | ||
cursor: pointer; | ||
object-fit: cover; // 가로-세로 비율 맞춰서 꽉 차게 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,14 +33,13 @@ $desktop-main-width: $main-nav-width + $main-post-bar-width + $main-gap + | |
*/ | ||
|
||
$default-z-index: 0; | ||
$modal-background-z-index: 1; | ||
$modal-content-z-index: 2; | ||
$modal-upper-z-index: 3; | ||
$modal-background-z-index: 20000; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 정리하신 부분 좋습니다! |
||
$modal-content-z-index: 20001; | ||
$modal-upper-z-index: 20002; | ||
|
||
/** | ||
* editor | ||
*/ | ||
|
||
$editing-form-width: 72rem; | ||
$device-editor-width: 64rem; // device 최대 너비가 69.5rem - 6:4정도 유지를 위해 40rem 선정 | ||
$line-width: 4rem; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export const isCloseModalElement = (element: HTMLElement): boolean => | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. 모달에 있는 버튼 클릭 이벤트에 이벤트 버블링을 제어하기 위해 작성한 코드입니다 |
||
element.matches(".modal-background") || | ||
element.matches(".modal-close-button") || | ||
element.matches("path"); |
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.
제가 확인하고 있던 뷰에선 없었습니다