mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-10-23 10:13:13 +02:00
25 lines
557 B
TypeScript
25 lines
557 B
TypeScript
import { Paper, Typography } from "@mui/material";
|
|
import React, { useEffect, useState } from "react";
|
|
|
|
interface IProps {
|
|
onFinish: () => void;
|
|
}
|
|
|
|
export function Countdown(props: IProps): React.ReactElement {
|
|
const [x, setX] = useState(3);
|
|
useEffect(() => {
|
|
if (x === 0) {
|
|
props.onFinish();
|
|
return;
|
|
}
|
|
setTimeout(() => setX(x - 1), 300);
|
|
});
|
|
|
|
return (
|
|
<Paper sx={{ p: 1, textAlign: "center" }}>
|
|
<Typography variant="h4">Get Ready!</Typography>
|
|
<Typography variant="h4">{x}</Typography>
|
|
</Paper>
|
|
);
|
|
}
|