From 22187f964a4d90ee85ef7cb6c0c16789cbf73b39 Mon Sep 17 00:00:00 2001 From: Cats Juice Date: Tue, 9 Jul 2024 16:17:55 +0800 Subject: [PATCH] fix(core): impl ai-island animation via css transform (#7458) --- .../src/components/pure/ai-island/index.tsx | 31 +++------ .../components/pure/ai-island/styles.css.ts | 65 ++++++++++++------- .../right-sidebar/entities/right-sidebar.ts | 11 ++-- 3 files changed, 56 insertions(+), 51 deletions(-) diff --git a/packages/frontend/core/src/components/pure/ai-island/index.tsx b/packages/frontend/core/src/components/pure/ai-island/index.tsx index 485a543e69eb2..daf449d0df8e9 100644 --- a/packages/frontend/core/src/components/pure/ai-island/index.tsx +++ b/packages/frontend/core/src/components/pure/ai-island/index.tsx @@ -8,30 +8,9 @@ import { aiIslandAnimationBg, aiIslandBtn, aiIslandWrapper, - borderAngle1, - borderAngle2, - borderAngle3, + gradient, } from './styles.css'; -if ( - typeof window !== 'undefined' && - window.CSS && - window.CSS.registerProperty -) { - const getName = (nameWithVar: string) => nameWithVar.slice(4, -1); - const registerAngle = (varName: string, initialValue: number) => { - window.CSS.registerProperty({ - name: getName(varName), - syntax: '', - inherits: false, - initialValue: `${initialValue}deg`, - }); - }; - registerAngle(borderAngle1, 0); - registerAngle(borderAngle2, 90); - registerAngle(borderAngle3, 180); -} - export const AIIsland = () => { // to make sure ai island is hidden first and animate in const [hide, setHide] = useState(true); @@ -52,7 +31,13 @@ export const AIIsland = () => { data-hide={hide} data-animation={!aiChatHasEverOpened} > -
+ {aiChatHasEverOpened ? null : ( +
+
+
+
+
+ )}