Skip to content

Commit bac74cf

Browse files
committed
feat: use react-tooltip and create tooltip-x
1 parent 59818f2 commit bac74cf

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"react-lazy-images": "^1.1.0",
4949
"react-snap-carousel": "^0.3.2",
5050
"react-syntax-highlighter": "15.5.0",
51+
"react-tooltip": "^5.28.0",
5152
"sharp": "^0.32.5",
5253
"slugify": "^1.6.6",
5354
"swr": "^2.2.2",

src/components/tooltip-x.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react'
2+
import { Tooltip } from 'react-tooltip'
3+
4+
type TooltipXProps = {
5+
className?: string
6+
content: string
7+
id: string
8+
}
9+
10+
export default function TooltipX(props: TooltipXProps) {
11+
return (
12+
<Tooltip
13+
anchorSelect={`#draft-${props.id}`}
14+
place="bottom"
15+
className="!text-sm !px-2 !py-0.5 !rounded-md"
16+
noArrow={true}
17+
defaultIsOpen={true}
18+
>
19+
{props.content}
20+
</Tooltip>
21+
)
22+
}

0 commit comments

Comments
 (0)