소스 검색

添加 showToolTip 属性

visuddhinanda 2 년 전
부모
커밋
b6fe7dbdd6
1개의 변경된 파일11개의 추가작업 그리고 2개의 파일을 삭제
  1. 11 2
      dashboard/src/components/general/TextDiff.tsx

+ 11 - 2
dashboard/src/components/general/TextDiff.tsx

@@ -6,8 +6,13 @@ const { Text } = Typography;
 interface IWidget {
   content?: string | null;
   oldContent?: string | null;
+  showToolTip?: boolean;
 }
-const TextDiffWidget = ({ content, oldContent }: IWidget) => {
+const TextDiffWidget = ({
+  content,
+  oldContent,
+  showToolTip = true,
+}: IWidget) => {
   if (content) {
     if (oldContent) {
       const diff: Change[] = diffChars(oldContent, content);
@@ -24,7 +29,11 @@ const TextDiffWidget = ({ content, oldContent }: IWidget) => {
           </Text>
         );
       });
-      return <Tooltip title={content}>{diffResult}</Tooltip>;
+      return showToolTip ? (
+        <Tooltip title={content}>{diffResult}</Tooltip>
+      ) : (
+        <> {diffResult}</>
+      );
     } else {
       return <Text>{content}</Text>;
     }