-
Notifications
You must be signed in to change notification settings - Fork 0
[DEV] 공유모달 UI 제작 #71
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
Merged
Merged
[DEV] 공유모달 UI 제작 #71
Changes from 5 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
76c5dd7
Merge branch 'develop' into dev/share-modal
drddyn 1ecb113
Merge branch 'dev/share-modal' of https://github.com/drddyn/Mine-FE i…
drddyn b8ded4b
fix: 공용 Toast, ConfirmModal 컴포넌트 분리
eun0903 6b6d9b8
Merge branch 'dev/share-modal' of https://github.com/drddyn/Mine-FE i…
eun0903 847ff3f
Merge branch 'develop' into dev/share-modal
drddyn 512f3fe
fix: 충돌 해결
drddyn 6a18d4e
feat: 비밀번호 수정 버튼 추가 및 스타일링변경
drddyn 71197fd
Merge branch 'develop' into dev/share-modal
drddyn 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 hidden or 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 hidden or 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 hidden or 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,82 @@ | ||
| import { useState } from 'react' | ||
| import X from '../../icon/X.svg?react' | ||
| import Link from '../../icon/link.svg?react' | ||
| import Twit from '../../icon/twitter.svg?react' | ||
| import Kakao from '../../icon/kakao.svg?react' | ||
| import Instagram from '../../icon/instagram.svg?react' | ||
| import Check from '../../icon/check.svg?react' | ||
|
|
||
| const MODAL_HEIGHT = 212 | ||
| const TOAST_MARGIN = 102 | ||
|
|
||
| interface ShareModalProps { | ||
| onClose: () => void | ||
| } | ||
|
|
||
| export default function ShareModal({ onClose }: ShareModalProps) { | ||
| const [showToast, setShowToast] = useState(false) | ||
|
|
||
| const handleCopyLink = async () => { | ||
| try { | ||
| await navigator.clipboard.writeText(window.location.href) | ||
| setShowToast(true) | ||
| setTimeout(() => setShowToast(false), 2000) | ||
| } catch (err) { | ||
| console.error('링크 복사에 실패했습니다:', err) | ||
| } | ||
| } | ||
|
|
||
| const buttons = [ | ||
| { icon: <Link className="w-6 h-6 **:stroke-white" />, label: '링크 복사', onClick: handleCopyLink }, | ||
| { icon: <Twit className="w-6 h-6 **:stroke-white" />, label: '트위터', onClick: () => {} }, | ||
| { icon: <Kakao className="w-6 h-6 **:stroke-white" />, label: '카카오톡', onClick: () => {} }, | ||
| { icon: <Instagram className="w-6 h-6 **:stroke-white" />, label: '인스타그램', onClick: () => {} }, | ||
| ] | ||
|
|
||
| return ( | ||
| <div className="fixed inset-0 bg-black/40 flex items-center justify-center z-999"> | ||
| <div | ||
| className="relative flex flex-col justify-center px-8 bg-gray-600-op80 rounded-2xl" | ||
| style={{ width: '480px', height: `${MODAL_HEIGHT}px`, gap: '25px' }} | ||
| > | ||
| <button onClick={onClose} className="absolute top-5 right-5"> | ||
| <X style={{ width: '16px', height: '16px' }} className="**:stroke-white" /> | ||
| </button> | ||
|
|
||
| <span className="font-semibold24 text-gray-100">공유</span> | ||
|
|
||
| <div className="flex items-center justify-center" style={{ gap: '28px' }}> | ||
| {buttons.map(({ icon, label, onClick }) => ( | ||
| <button | ||
| key={label} | ||
| onClick={onClick} | ||
| className="flex flex-col items-center w-16 gap-2" | ||
| > | ||
| <div className="w-14 h-14 flex items-center justify-center rounded-full border border-gray-100"> | ||
| {icon} | ||
| </div> | ||
| <span className="font-medium12 text-gray-100 text-center">{label}</span> | ||
| </button> | ||
| ))} | ||
| </div> | ||
| </div> | ||
|
|
||
| {showToast && ( | ||
| <div | ||
| className="absolute animate-in fade-in slide-in-from-top-2 flex items-center bg-gray-500 rounded-lg px-5 py-3" | ||
| style={{ | ||
| top: `calc(50% + ${MODAL_HEIGHT / 2}px + ${TOAST_MARGIN}px)`, | ||
| left: '50%', | ||
| transform: 'translateX(-50%)', | ||
| width: '270px', | ||
| height: '48px', | ||
| gap: '12px', | ||
| }} | ||
| > | ||
| <Check className="w-5 h-5 text-gray-100" /> | ||
| <span className="font-semibold16 text-gray-100">링크가 복사되었습니다.</span> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ) | ||
| } | ||
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.
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 hidden or 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 hidden or 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,9 @@ | ||
| export const isValidUrl = (url?: string) => { | ||
| if (!url) return false | ||
| try { | ||
| const parsed = new URL(url) | ||
| return parsed.protocol === 'https:' | ||
| } catch { | ||
| return false | ||
| } | ||
| } |
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.
스크린세팅에 있는 아래 토스트랑 통합해서 공용 컴포넌트로 만들고 불러와서 쓰는 형식으로 바꾸면 좋을 것 같습니다.