mirror of
https://github.com/remvze/moodist.git
synced 2026-02-28 09:03:12 +08:00
feat: add binary animation
This commit is contained in:
17
src/components/binary.tsx
Normal file
17
src/components/binary.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
|
||||
import { generateRandomBinaryString } from '@/helpers/binary';
|
||||
|
||||
export function Binary() {
|
||||
const [binary, setBinary] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
setBinary(generateRandomBinaryString(1000));
|
||||
|
||||
setInterval(() => {
|
||||
setBinary(generateRandomBinaryString(1000));
|
||||
}, 200);
|
||||
}, []);
|
||||
|
||||
return <span>{binary}</span>;
|
||||
}
|
||||
@@ -3,10 +3,7 @@ import { FaGithub } from 'react-icons/fa/index';
|
||||
|
||||
import { SpecialButton } from './special-button';
|
||||
import { Container } from './container';
|
||||
|
||||
import { generateRandomBinaryString } from '@/helpers/binary';
|
||||
|
||||
const binary = generateRandomBinaryString(1000);
|
||||
import { Binary } from './binary';
|
||||
---
|
||||
|
||||
<div class="source">
|
||||
@@ -28,7 +25,7 @@ const binary = generateRandomBinaryString(1000);
|
||||
</SpecialButton>
|
||||
</div>
|
||||
|
||||
<div class="binary">{binary}</div>
|
||||
<div class="binary"><Binary client:load /></div>
|
||||
</div>
|
||||
</Container>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user