Skip to content

Commit bca569d

Browse files
committed
fix: slogon animation
1 parent a0dcc68 commit bca569d

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/components/HomePageHeader/index.tsx

+19-2
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,31 @@ const list = [
3030
]
3131

3232
const HomeHead: FC = () => {
33-
const [stars, setStars] = useState(0);
3433
const [slogan, setSlogan] = useState(<Translate id="home.title.qa">
3534
Q&A Platform
3635
</Translate>);
3736
const [sloganClass, setSloganClss] = useState('sloganIn');
3837

3938
const { i18n: { currentLocale } } = useDocusaurusContext();
4039

40+
useEffect(() => {
41+
let i = 0;
42+
const timer = setInterval(() => {
43+
setSloganClss('sloganOut');
44+
setTimeout(() => {
45+
setSlogan(list[i]);
46+
setSloganClss('sloganIn');
47+
}, 300);
48+
i++;
49+
if (i === list.length) {
50+
i = 0;
51+
}
52+
}, 4500);
53+
() => {
54+
clearInterval(timer)
55+
}
56+
}, []);
57+
4158

4259

4360
function numWord($num) {
@@ -114,7 +131,7 @@ const HomeHead: FC = () => {
114131
>
115132
<Icon name="github" size="24px" className="me-2" />
116133
{` Star `}
117-
13.9k
134+
14k
118135
</Button>
119136
</div>
120137
</Col>

0 commit comments

Comments
 (0)