Skip to content

Commit

Permalink
feat: Share 버튼 Click Event Binding(테스트)
Browse files Browse the repository at this point in the history
  • Loading branch information
jungwoo3490 committed Jan 16, 2024
1 parent 840cfd9 commit 5734c86
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/common/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,20 @@ export function HomeButton() {
}

export function ShareButton() {
const handleClickShareButton = () => {};
const handleClickShareButton = async () => {
try {
if (navigator.share) {
await navigator.share({
title: 'Lecue',
url: window.location.href,
});
} else {
alert('이 브라우저에서는 내장 공유 기능을 지원하지 않습니다.');
}
} catch (error) {
console.error('내장 공유 기능을 실행하는 중 에러가 발생했습니다:', error);
}
};

return (
<S.HeaderButton onClick={handleClickShareButton}>
Expand Down

0 comments on commit 5734c86

Please sign in to comment.