퍼가기

This commit is contained in:
2025-06-30 19:33:31 +09:00
parent 00329ff32b
commit 419099d233
2 changed files with 1994 additions and 1718 deletions
@@ -2,6 +2,7 @@ import { useRouter, usePathname } from "next/navigation";
import { useConfirm } from "@frontend-opensource/use-react-hooks";
import { Button } from "@common/components";
import { useMenuStore, useUserStore } from "@/shared/lib";
import { useState } from 'react';
type PostActionProps = {
bbsId: string;
@@ -16,6 +17,7 @@ function PostAction({ children, handleDelete }: PostActionProps) {
const { confirm } = useConfirm();
const bbsInfo = useMenuStore((state) => state.bbsInfo);
const userInfo = useUserStore((state) => state.userInfo);
const [copied, setCopied] = useState(false);
const onDelete = async () => {
if (await confirm("삭제하시겠습니까?")) handleDelete();
@@ -33,11 +35,31 @@ function PostAction({ children, handleDelete }: PostActionProps) {
// 비회원
return true;
};
const handleCopy = async () => {
try {
await navigator.clipboard.writeText(window.location.href);
setCopied(true);
setTimeout(() => setCopied(false), 2000); // 2초 후 상태 초기화
alert("복사되었습니다..")
} catch (err) {
console.error('복사 실패:', err);
}
};
return (
<>
{children}
<div className="flex justify-center gap-4 pb-12 pt-10">
<Button
size="lg"
color="white"
type="button"
onClick={() => handleCopy()}
>
퍼가기
</Button>
<Button
size="lg"
color="white"
+1972 -1718
View File
File diff suppressed because it is too large Load Diff