From 5734c86fd3c4e985f42fd40c32b02ac53ac090ab Mon Sep 17 00:00:00 2001 From: jungwoo3490 Date: Wed, 17 Jan 2024 01:28:42 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Share=20=EB=B2=84=ED=8A=BC=20Click=20Ev?= =?UTF-8?q?ent=20Binding(=ED=85=8C=EC=8A=A4=ED=8A=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Header/index.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/common/Header/index.tsx b/src/components/common/Header/index.tsx index e8857944..eeff07e0 100644 --- a/src/components/common/Header/index.tsx +++ b/src/components/common/Header/index.tsx @@ -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 (