From 4106f3c7c075feb04e4a54d439f95d126f879857 Mon Sep 17 00:00:00 2001 From: yeokyoung song Date: Wed, 6 Mar 2024 00:36:34 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20tooltip=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/garden/index.tsx | 53 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/pages/garden/index.tsx b/pages/garden/index.tsx index e503feb..0752e1b 100644 --- a/pages/garden/index.tsx +++ b/pages/garden/index.tsx @@ -1,4 +1,4 @@ -import { ReactNode, useEffect, useMemo, useState } from 'react' +import { ReactNode, useEffect, useMemo, useRef, useState } from 'react' import BaseLayout from '@/layout/base-layout' import withAuth from '@/layout/HOC/with-auth' import Button from '@/components/button' @@ -13,6 +13,7 @@ import { AnimatePresence } from 'framer-motion' import { motion } from 'framer-motion' import { fadeInProps } from '@/variants' import ShareModal from '@/components/share-modal' +import InfoIcon from '@/components/svgs/info-icon' const Pages = () => { const { data } = useSession() @@ -72,6 +73,17 @@ const Pages = () => { () => surveys?.pages[0].data.totalCount ?? 0, [surveys], ) + + const [showTooltip, setShowTooltip] = useState(false) + const tooltipRef = useRef(null) + + useEffect(() => { + function handleClickOutside() { + setShowTooltip(false) + } + document.addEventListener('mousedown', handleClickOutside) + }, [tooltipRef]) + return ( {
-
-

+

+

받은 친구

+ + {showTooltip && ( + + + + + +
+

+ 알게 된 기간, 경로에 따라
나무 모양과 색이 달라져요 +

+
+
+ )}