Last active
May 21, 2020 15:19
-
-
Save kyleshevlin/5d5482d30f895840d29346d10be99f03 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const NEXT_DOTS = { | |
'': '.', | |
'.': '. .', | |
'. .': '. . .', | |
'. . .': '', | |
} | |
function Dots() { | |
const [dots, setDots] = React.useState('') | |
React.useEffect(() => { | |
const intervalId = setInterval(() => { | |
setDots(d => NEXT_DOTS[d]) | |
}, 350) | |
return () => clearInterval(intervalId) | |
}, []) | |
return ( | |
<div | |
css={{ | |
display: 'inline-block', | |
textAlign: 'center', | |
width: 30, | |
}} | |
> | |
{dots} | |
</div> | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment