-
Notifications
You must be signed in to change notification settings - Fork 6
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
feat(toks-components, quiz): Image Preview 기능 구현 #403
Merged
+133
−35
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
87656b4
:sparkles: feat: quiz button 영역 조정
chaaerim a0cc2ca
:sparkles: feat: add modal component
chaaerim 5259bd3
:sparkles: feat: 썸네일 image 모달 적용중 ...
chaaerim 92f9290
:art: style: preview img border radius 적용
chaaerim a2e1c61
:bug: fix: fix next/image warning
chaaerim 03f87a6
:bug: fix: fix lint error
chaaerim 40a8a69
:sparkles: feat: thumbnail 컴포넌트에 modal 컴포넌트 종속
chaaerim dfa9684
:sparkles: feat: Dimmer framer-motion 적용
chaaerim d9a068b
Merge branch 'dev' into feat/image-preview
chaaerim 07c8748
:bug: fix: delete unuse import
chaaerim 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
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
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,67 @@ | ||
'use client'; | ||
|
||
import { AnimatePresence, motion } from 'framer-motion'; | ||
import Image from 'next/image'; | ||
import { PropsWithChildren, ReactNode } from 'react'; | ||
|
||
import { ICON_URL } from '@/common'; | ||
|
||
import { GlobalPortal } from '../GlobalPortal'; | ||
|
||
type ModalProp = { | ||
isShow: boolean; | ||
onClose: VoidFunction; | ||
}; | ||
|
||
export const Modal = ({ | ||
isShow, | ||
onClose, | ||
children, | ||
}: PropsWithChildren<ModalProp>) => { | ||
return ( | ||
<GlobalPortal.Consumer> | ||
<Dimmer isShow={isShow} onClose={onClose} children={children} /> | ||
</GlobalPortal.Consumer> | ||
); | ||
}; | ||
|
||
const backdropVariants = { | ||
hidden: { opacity: 0 }, | ||
visible: { opacity: 1 }, | ||
}; | ||
|
||
const Dimmer = ({ | ||
isShow, | ||
onClose, | ||
children, | ||
}: { | ||
isShow: boolean; | ||
onClose: VoidFunction; | ||
children: ReactNode; | ||
}) => { | ||
return ( | ||
<AnimatePresence> | ||
{isShow && ( | ||
<motion.div | ||
initial="hidden" | ||
animate="visible" | ||
exit="hidden" | ||
variants={backdropVariants} | ||
transition={{ duration: 0.3 }} | ||
onClick={() => onClose()} | ||
className="fixed left-0 top-0 z-50 flex h-full w-full items-center justify-center bg-gray-120/80 p-20px" | ||
> | ||
<div className="flex flex-col"> | ||
<button | ||
className="flex justify-end pb-16px" | ||
onClick={() => onClose()} | ||
> | ||
<Image src={ICON_URL.CLOSE} alt="close" width={24} height={24} /> | ||
</button> | ||
{children} | ||
</div> | ||
</motion.div> | ||
)} | ||
</AnimatePresence> | ||
); | ||
}; |
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.
next Image를 사용할 때 콘솔에
src has either width or height modified, but not the other. If you use CSS to change the size of your image, also include the styles 'width: "auto"' or 'height: "auto"' to maintain the aspect ratio.
warning이 여러번 떴었는데요, 해당 warning을 해결하기 위해서는 width나 height 둘 중 하나를 auto로 설정해서 ratio를 맞춰야하는데 next Image를 사용할 때에는 width와 height 두 속성 모두 지정을 해줘야만했기 때문에 위와 같은 방식으로 작성하게 되었습니다!next/image