diff --git a/public/share/share-copy.svg b/public/share/share-copy.svg new file mode 100644 index 00000000..11614872 --- /dev/null +++ b/public/share/share-copy.svg @@ -0,0 +1,4 @@ + + + + diff --git a/public/share/share-kakao.svg b/public/share/share-kakao.svg new file mode 100644 index 00000000..f077eb2c --- /dev/null +++ b/public/share/share-kakao.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/public/share/share-native.svg b/public/share/share-native.svg new file mode 100644 index 00000000..4b06e983 --- /dev/null +++ b/public/share/share-native.svg @@ -0,0 +1,4 @@ + + + + diff --git a/src/app/(route)/list/[id]/_components/PostDetail/_internal/PostDetailBody/PostDetailBody.tsx b/src/app/(route)/list/[id]/_components/PostDetail/_internal/PostDetailBody/PostDetailBody.tsx index 149859cf..972fcb80 100644 --- a/src/app/(route)/list/[id]/_components/PostDetail/_internal/PostDetailBody/PostDetailBody.tsx +++ b/src/app/(route)/list/[id]/_components/PostDetail/_internal/PostDetailBody/PostDetailBody.tsx @@ -1,6 +1,6 @@ import { formatNumber } from "@/utils"; -import { CategoryType, ItemStatus } from "@/types"; import { Icon } from "@/components"; +import { CategoryType, ItemStatus } from "@/types"; import { NoticeChip } from "@/app/(route)/notice/_components"; import PostChipSection from "../PostChipSection/PostChipSection"; import { LABELS } from "../../LABELS"; diff --git a/src/app/(route)/list/[id]/_components/PostDetailTopHeader/PostDetailTopHeader.tsx b/src/app/(route)/list/[id]/_components/PostDetailTopHeader/PostDetailTopHeader.tsx index bc0158d6..33bdc64a 100644 --- a/src/app/(route)/list/[id]/_components/PostDetailTopHeader/PostDetailTopHeader.tsx +++ b/src/app/(route)/list/[id]/_components/PostDetailTopHeader/PostDetailTopHeader.tsx @@ -1,14 +1,22 @@ "use client"; +import { useState } from "react"; import { DetailHeader } from "@/components"; +import PostShare from "../PostShare/PostShare"; const PostDetailTopHeader = () => { + const [openShareModal, setOpenShareModal] = useState(false); + return ( - - - - - + <> + + + setOpenShareModal(true)} /> + + + + setOpenShareModal(false)} /> + > ); }; diff --git a/src/app/(route)/list/[id]/_components/PostShare/PostShare.tsx b/src/app/(route)/list/[id]/_components/PostShare/PostShare.tsx new file mode 100644 index 00000000..3723041f --- /dev/null +++ b/src/app/(route)/list/[id]/_components/PostShare/PostShare.tsx @@ -0,0 +1,80 @@ +import Image from "next/image"; +import { Button, PopupLayout } from "@/components"; +import { SHARE, ShareId } from "./SHARE"; + +interface PostShareProps { + isOpen: boolean; + onClose: () => void; +} + +const PostShare = ({ isOpen, onClose }: PostShareProps) => { + const handleShareClick = (id: ShareId) => { + switch (id) { + case "kakao": + // kakaoShare(); + break; + case "native": + // nativeShare(); + break; + case "copy": + // copyLink(); + break; + default: + break; + } + }; + + return ( + + + 게시글 공유하기 + + {SHARE.map((item) => ( + handleShareClick(item.id)} + /> + ))} + + + + + 닫기 + + + ); +}; + +export default PostShare; + +const ShareOptionButton = ({ + src, + name, + onClick, +}: { + src: string; + name: string; + onClick: () => void; +}) => { + return ( + + + {name} + + ); +}; diff --git a/src/app/(route)/list/[id]/_components/PostShare/SHARE.ts b/src/app/(route)/list/[id]/_components/PostShare/SHARE.ts new file mode 100644 index 00000000..cfe300a9 --- /dev/null +++ b/src/app/(route)/list/[id]/_components/PostShare/SHARE.ts @@ -0,0 +1,7 @@ +export const SHARE = [ + { id: "kakao", src: "/share/share-kakao.svg", name: "카카오톡" }, + { id: "native", src: "/share/share-native.svg", name: "공유하기" }, + { id: "copy", src: "/share/share-copy.svg", name: "링크 복사" }, +] as const; + +export type ShareId = (typeof SHARE)[number]["id"]; diff --git a/src/app/(route)/list/[id]/_components/index.ts b/src/app/(route)/list/[id]/_components/index.ts index 0c4ef377..a4c59722 100644 --- a/src/app/(route)/list/[id]/_components/index.ts +++ b/src/app/(route)/list/[id]/_components/index.ts @@ -1,3 +1,4 @@ export { default as CommentForm } from "./CommentForm/CommentForm"; export { default as PostDetail } from "./PostDetail/PostDetail"; export { default as SimilarItemsSection } from "./SimilarItemsSection/SimilarItemsSection"; +export { default as PostShare } from "./PostShare/PostShare";