34 lines
758 B
TypeScript
Raw Normal View History

2024-05-09 17:18:51 +08:00
import { memo } from 'react'
import ShortcutsName from '../shortcuts-name'
2024-08-26 13:00:02 +08:00
import Tooltip from '@/app/components/base/tooltip'
2024-05-09 17:18:51 +08:00
type TipPopupProps = {
title: string
children: React.ReactNode
shortcuts?: string[]
}
const TipPopup = ({
title,
children,
shortcuts,
}: TipPopupProps) => {
return (
2024-08-26 13:00:02 +08:00
<Tooltip
2024-05-09 17:18:51 +08:00
offset={4}
popupClassName='!p-0 !bg-gray-25'
popupContent={
<div className='flex items-center gap-1 px-2 h-6 text-xs font-medium text-gray-700 rounded-lg border-[0.5px] border-black/5'>
{title}
{
shortcuts && <ShortcutsName keys={shortcuts} className='!text-[11px]' />
}
</div>
}
>
{children}
2024-08-26 13:00:02 +08:00
</Tooltip>
2024-05-09 17:18:51 +08:00
)
}
export default memo(TipPopup)