Tooltip์ ์ปค์๋ฅผ ํน์ ๊ตฌ์ฑ ์์์ hover ๋๋ฉด ํด๋น ์์ญ์ ๋ํ ์ ๋ณด๋ฅผ ํ์ํ๋ GUI ์์์ด๋ค.
ํ๋ฉด์ ์๋ก์ด ๊ธฐ๋ฅ์ด๋ ํน์ ์์์ ๋ํ ์๋ด๊ฐ ํ์ํ ๊ฒฝ์ฐ ํ๋ฉด์ Dimmed ์ฒ๋ฆฌํ๊ณ ๋์๋ง์ด๋ ์ ๋ณด๋ฅผ ํ์ํ ์ ์๋ค.
์ฌ์ฉ์ ์ํธ์์ฉ์ ์ํ ํ์ ์ข ๋ฅ๋ ๋ค์ ๊ธ์ ์๋ค. -> Toast ์ ์ฉ๊ธฐ
๋์จ ๋์์ธ์ ๋ค์๊ณผ ๊ฐ์ ํดํ UI๊ฐ ์์๊ณ , ์ด๋ ๊ฒ ํดํ ์ปดํฌ๋ํธ๋ฅผ ๊ตฌํํ๋ค.

import React from 'react'
interface TooltipProps {
children: React.ReactNode
}
export default function Tooltip({ children }: TooltipProps) {
return (
<div className='group relative flex items-center justify-center mt-[40px] w-full h-fit flex-col gap-2'>
<div className='absolute top-[-60px] hidden group-hover:flex flex-col items-center gap-4 max-w-[300px] '>
<div className='bg-black rounded-full py-3 px-[20px] h-[40px] relative flex items-center '>
<p className='line-height: 1.5rem text-[12px] text-white leading-none'>
๐ ์น๊ตฌ์๊ฒ ๊ฐ์ ์ด๋ชจ์ง๋ฅผ ๋ณด๋ผ ์ ์์ด์!
</p>
<div className='absolute w-3 h-3 bg-black transform rotate-45 left-1/2 -translate-x-1/2 -bottom-1.5'></div>
</div>
</div>
{children}
</div>
)
}
'What I Learn' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| e.stopPropagation(), ์ด๋ฒคํธ ์ ํ ๋ฐฉ์ง (0) | 2024.12.10 |
|---|---|
| format date as 'YYYY.MM.DD AMhh:mm' (0) | 2024.12.10 |
| Lottie๋ก ์ชฝ์ง ์ธ๋ค์ผ์ ์ ์ฉํ๊ธฐ (0) | 2024.12.10 |
| TanStack Query์ ํจ๊ป ๊ตฌํํ cursor ๋ฐฉ์์ ๋ฌดํ ์คํฌ๋กค (1) | 2024.12.10 |
| Toast ์ ์ฉ๊ธฐ (0) | 2024.12.10 |
