From 6d6c154d4382978d4c0fbffbf846660f3b6af491 Mon Sep 17 00:00:00 2001 From: jungwoo3490 Date: Tue, 16 Jan 2024 23:05:22 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20Home=20=EB=B2=84=ED=8A=BC=20Click?= =?UTF-8?q?=20Event=20Binding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Header/index.tsx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/common/Header/index.tsx b/src/components/common/Header/index.tsx index a3cf11e8..79c5b6a6 100644 --- a/src/components/common/Header/index.tsx +++ b/src/components/common/Header/index.tsx @@ -1,3 +1,5 @@ +import { useNavigate } from 'react-router-dom'; + import { IcArrowLeftBlack, IcArrowLeftWhite, @@ -31,8 +33,9 @@ function Header({ headerTitle, isDarkMode, isDetailPage }: HeaderProps) { } export function HomeButton() { + const navigate = useNavigate(); const handleClickHomeButton = () => { - // 홈으로 이동하는 로직 추후 구현 필요 + navigate('/'); }; return ( @@ -43,9 +46,7 @@ export function HomeButton() { } export function ShareButton() { - const handleClickShareButton = () => { - // 공유(?) 페이지로 이동하는 로직 추후 구현 필요 - }; + const handleClickShareButton = () => {}; return ( @@ -55,9 +56,7 @@ export function ShareButton() { } export function BackButton({ isDarkMode }: HeaderButtonProps) { - const handleClickBackButton = () => { - // 뒤로 이동하는 로직 추후 구현 필요 - }; + const handleClickBackButton = () => {}; return ( From 840cfd9ab7e170d5c107dbfb07226dc118dc307d Mon Sep 17 00:00:00 2001 From: jungwoo3490 Date: Tue, 16 Jan 2024 23:07:21 +0900 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20Back=20=EB=B2=84=ED=8A=BC=20Click?= =?UTF-8?q?=20Event=20Binding?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/common/Header/index.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/common/Header/index.tsx b/src/components/common/Header/index.tsx index 79c5b6a6..e8857944 100644 --- a/src/components/common/Header/index.tsx +++ b/src/components/common/Header/index.tsx @@ -56,7 +56,10 @@ export function ShareButton() { } export function BackButton({ isDarkMode }: HeaderButtonProps) { - const handleClickBackButton = () => {}; + const navigate = useNavigate(); + const handleClickBackButton = () => { + navigate(-1); + }; return ( From 5734c86fd3c4e985f42fd40c32b02ac53ac090ab Mon Sep 17 00:00:00 2001 From: jungwoo3490 Date: Wed, 17 Jan 2024 01:28:42 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20Share=20=EB=B2=84=ED=8A=BC=20Click?= =?UTF-8?q?=20Event=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 (