Skip to content

Commit 6d1fa12

Browse files
committed
feat: 게시글 공유 기능
1 parent c1f2117 commit 6d1fa12

File tree

1 file changed

+7
-1
lines changed
  • src/features/detail/components/DetailHeader

1 file changed

+7
-1
lines changed

src/features/detail/components/DetailHeader/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,29 @@ import * as s from './style.css';
55
import useDrawer from '@/common/hooks/useDrawer';
66
import OptionDrawer from '@/features/detail/components/OptionDrawer';
77
import type { ItemDetailInterface } from '../../types';
8+
import { useToast } from '@/common/hooks/useToast';
89

910
interface Props {
1011
state: ItemDetailInterface;
1112
}
1213
const DetailHeader = ({ state }: Props) => {
1314
const navigate = useNavigate();
1415
const { open, drawerState } = useDrawer();
16+
const { openToast } = useToast();
1517

1618
const goBack = () => navigate(-1);
19+
const handleShare = () => {
20+
navigator.clipboard.writeText(window.location.href);
21+
openToast({ message: '링크가 복사되었어요' });
22+
};
1723

1824
return (
1925
<>
2026
<div className={s.Filter} />
2127
<header className={s.Container}>
2228
<button className={`mgc_left_line ${s.BackButton}`} onClick={goBack} aria-label="Go back" />
2329
<div className={s.RightSide}>
24-
<button className={`${s.RightButton} mgc_share_3_fill`} aria-label="Share item" />
30+
<button className={`${s.RightButton} mgc_share_3_fill`} aria-label="Share item" onClick={handleShare} />
2531
<button className={`${s.RightButton} mgc_more_2_fill`} onClick={open} />
2632
</div>
2733
</header>

0 commit comments

Comments
 (0)