teableio/teable

View on GitHub
packages/sdk/src/components/expand-record/TooltipWrap.tsx

Summary

Maintainability
A
0 mins
Test Coverage
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@teable/ui-lib';
import type { FC, PropsWithChildren } from 'react';

export const TooltipWrap: FC<PropsWithChildren<{ description: string; disabled?: boolean }>> = (
  props
) => {
  const { description, disabled, children } = props;
  if (disabled) {
    return <>{children}</>;
  }
  return (
    <TooltipProvider>
      <Tooltip>
        <TooltipTrigger asChild>{children}</TooltipTrigger>
        <TooltipContent>
          <p>{description}</p>
        </TooltipContent>
      </Tooltip>
    </TooltipProvider>
  );
};