다시 작업. 디자인도 바꾸고 서버도 바꿈. Co-authored-by: monoid <jaeung@prelude.duckdns.org> Reviewed-on: https://git.prelude.duckdns.org/monoid/ionian/pulls/6
25 lines
639 B
TypeScript
25 lines
639 B
TypeScript
import React from "react";
|
|
|
|
export function Spinner(props: { className?: string; }) {
|
|
const chars = ["⠋",
|
|
"⠙",
|
|
"⠹",
|
|
"⠸",
|
|
"⠼",
|
|
"⠴",
|
|
"⠦",
|
|
"⠧",
|
|
"⠇",
|
|
"⠏"
|
|
];
|
|
const [index, setIndex] = React.useState(0);
|
|
React.useEffect(() => {
|
|
const interval = setInterval(() => {
|
|
setIndex((index + 1) % chars.length);
|
|
}, 80);
|
|
return () => clearInterval(interval);
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
}, [index]);
|
|
|
|
return <span className={props.className}>{chars[index]}</span>;
|
|
}
|