'use client'; import './style.scss'; import { useEffect, useState } from 'react'; import { Copy } from 'lucide-react'; import { Button } from '@/components/ui/button'; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; type Props = { isEnable: boolean; open: boolean; onChange: (open: boolean) => void; } export default function Copied({ isEnable, open, onChange }: Props) { const [url, setUrl] = useState(''); useEffect(() => { if (typeof window !== 'undefined') { setUrl(window.location.href); } }, []); if (!isEnable) { return; } const handleCopy = async () => { try { await navigator.clipboard.writeText(url); alert("주소가 복사되었습니다."); onChange(false); } catch (err) { console.error("복사 실패:", err); } }; return ( 주소 복사 이 주소를 복사하여 다른 곳에 붙여넣기 하세요.
); }