This is an automated email from the ASF dual-hosted git repository.

shuai pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/answer-website.git


The following commit(s) were added to refs/heads/main by this push:
     new bca569d82 fix: slogon animation
bca569d82 is described below

commit bca569d82d4c284a4ce27af26bd36647413903a2
Author: shuai <[email protected]>
AuthorDate: Mon Feb 24 17:26:18 2025 +0800

    fix: slogon animation
---
 src/components/HomePageHeader/index.tsx | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/components/HomePageHeader/index.tsx 
b/src/components/HomePageHeader/index.tsx
index bb11a15af..b4640faca 100644
--- a/src/components/HomePageHeader/index.tsx
+++ b/src/components/HomePageHeader/index.tsx
@@ -30,7 +30,6 @@ const list = [
 ]
 
 const HomeHead: FC = () => {
-  const [stars, setStars] = useState(0);
   const [slogan, setSlogan] = useState(<Translate id="home.title.qa">
   Q&A Platform
 </Translate>);
@@ -38,6 +37,24 @@ const HomeHead: FC = () => {
 
   const { i18n: { currentLocale } } = useDocusaurusContext();
 
+  useEffect(() => {
+      let i = 0;
+      const timer = setInterval(() => {
+        setSloganClss('sloganOut');
+        setTimeout(() => {
+          setSlogan(list[i]);
+          setSloganClss('sloganIn');
+        }, 300);
+        i++;
+        if (i === list.length) {
+          i = 0;
+        }
+      }, 4500);
+    () => {
+      clearInterval(timer)
+    }
+  }, []);
+
 
 
   function numWord($num) {
@@ -114,7 +131,7 @@ const HomeHead: FC = () => {
               >
                 <Icon name="github" size="24px"  className="me-2" />
                 {` Star `}
-                13.9k
+                14k
               </Button>
             </div>
           </Col>

Reply via email to