tip-popup.tsx 758 B

123456789101112131415161718192021222324252627282930313233
  1. import { memo } from 'react'
  2. import ShortcutsName from '../shortcuts-name'
  3. import Tooltip from '@/app/components/base/tooltip'
  4. type TipPopupProps = {
  5. title: string
  6. children: React.ReactNode
  7. shortcuts?: string[]
  8. }
  9. const TipPopup = ({
  10. title,
  11. children,
  12. shortcuts,
  13. }: TipPopupProps) => {
  14. return (
  15. <Tooltip
  16. offset={4}
  17. popupClassName='!p-0 !bg-gray-25'
  18. popupContent={
  19. <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'>
  20. {title}
  21. {
  22. shortcuts && <ShortcutsName keys={shortcuts} className='!text-[11px]' />
  23. }
  24. </div>
  25. }
  26. >
  27. {children}
  28. </Tooltip>
  29. )
  30. }
  31. export default memo(TipPopup)