Browse Source

Merge pull request #2174 from Yidadaa/bugfix-0627

fix: #2149 try to fix chat action button style
Yifei Zhang 1 year ago
parent
commit
efbd1c15a9
1 changed files with 9 additions and 3 deletions
  1. 9 3
      app/components/chat.tsx

+ 9 - 3
app/components/chat.tsx

@@ -294,8 +294,8 @@ function ChatAction(props: {
   const iconRef = useRef<HTMLDivElement>(null);
   const textRef = useRef<HTMLDivElement>(null);
   const [width, setWidth] = useState({
-    full: 20,
-    icon: 20,
+    full: 16,
+    icon: 16,
   });
 
   function updateWidth() {
@@ -310,7 +310,13 @@ function ChatAction(props: {
   }
 
   useEffect(() => {
-    setTimeout(updateWidth, 100);
+    const onClick = () => setTimeout(updateWidth, 10);
+    onClick();
+
+    window.addEventListener("click", onClick);
+    return () => {
+      window.removeEventListener("click", onClick);
+    };
   }, []);
 
   return (