mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-10 11:26:52 +08:00
47 lines
1.1 KiB
TypeScript
47 lines
1.1 KiB
TypeScript
import React, { useState } from 'react'
|
|
import type { FC } from 'react'
|
|
import {
|
|
PortalToFollowElem,
|
|
PortalToFollowElemContent,
|
|
PortalToFollowElemTrigger,
|
|
} from '@/app/components/base/portal-to-follow-elem'
|
|
|
|
type TooltipProps = {
|
|
data: number | string
|
|
text: string
|
|
icon: React.ReactNode
|
|
}
|
|
|
|
const Tooltip: FC<TooltipProps> = ({
|
|
data,
|
|
text,
|
|
icon,
|
|
}) => {
|
|
const [open, setOpen] = useState(false)
|
|
|
|
return (
|
|
<PortalToFollowElem
|
|
open={open}
|
|
onOpenChange={setOpen}
|
|
placement='top-start'
|
|
>
|
|
<PortalToFollowElemTrigger
|
|
onMouseEnter={() => setOpen(true)}
|
|
onMouseLeave={() => setOpen(false)}
|
|
>
|
|
<div className='flex items-center mr-6'>
|
|
{icon}
|
|
{data}
|
|
</div>
|
|
</PortalToFollowElemTrigger>
|
|
<PortalToFollowElemContent style={{ zIndex: 1001 }}>
|
|
<div className='p-3 bg-components-tooltip-bg system-xs-medium text-text-quaternary rounded-lg shadow-lg'>
|
|
{text} {data}
|
|
</div>
|
|
</PortalToFollowElemContent>
|
|
</PortalToFollowElem>
|
|
)
|
|
}
|
|
|
|
export default Tooltip
|