Ver Fonte

拆分按钮默认隐藏

visuddhinanda há 3 anos atrás
pai
commit
cb5370693b

+ 16 - 8
dashboard/src/components/template/Wbw/WbwCase.tsx

@@ -13,6 +13,7 @@ interface IWidget {
 }
 const Widget = ({ data, onSplit }: IWidget) => {
   const intl = useIntl();
+  const showSplit: boolean = data.factors?.value.includes("+") ? true : false;
   return (
     <div className="wbw_word_item" style={{ display: "flex" }}>
       <Text type="secondary">
@@ -24,14 +25,21 @@ const Widget = ({ data, onSplit }: IWidget) => {
               </span>
             );
           })}
-          <Button
-            icon={<SwapOutlined />}
-            onClick={() => {
-              if (typeof onSplit !== "undefined") {
-                onSplit();
-              }
-            }}
-          />
+          {showSplit ? (
+            <Button
+              className="wbw_split"
+              size="small"
+              shape="circle"
+              icon={<SwapOutlined />}
+              onClick={() => {
+                if (typeof onSplit !== "undefined") {
+                  onSplit(true);
+                }
+              }}
+            />
+          ) : (
+            <></>
+          )}
         </div>
       </Text>
     </div>

+ 6 - 0
dashboard/src/components/template/Wbw/wbw.css

@@ -3,6 +3,12 @@
   padding-right: 0;
   max-width: 60vw;
 }
+.wbw_split {
+  visibility: hidden;
+}
+.wbw_word:hover .wbw_split {
+  visibility: visible;
+}
 .block .pali {
   font-weight: 500;
   font-size: 110%;