Added a typewriter component.

This commit is contained in:
HP
2026-01-16 21:40:07 -05:00
parent ff6eb30f96
commit ec526ed4e3
4 changed files with 53 additions and 5 deletions

View File

@@ -12,6 +12,7 @@ import {
} from "@mui/material"; } from "@mui/material";
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { paths } from "@/paths"; import { paths } from "@/paths";
import Typewriter from "@/components/Typewriter/Typewriter";
const navItems = [ const navItems = [
{ label: "Visions Of Reality", path: paths.games.vor }, { label: "Visions Of Reality", path: paths.games.vor },
@@ -31,6 +32,7 @@ export default function VisionsOfReality() {
<Stack spacing={2}> <Stack spacing={2}>
<Box> <Box>
<Typography variant="h5" fontWeight={700}> <Typography variant="h5" fontWeight={700}>
Some online games available to you. Some online games available to you.
</Typography> </Typography>

View File

@@ -58,11 +58,6 @@ export default function Home() {
}} }}
/> />
<Typography sx={{
}}>
Tartarus
</Typography>
<Container <Container
maxWidth="lg" maxWidth="lg"
sx={{ sx={{

View File

@@ -0,0 +1,16 @@
import "./index.css";
interface TypewriterProps{
value: string;
color?: string;
}
export default function Typewriter({ value, color }: TypewriterProps) {
return (
<div className="typewriter">
<div>
<p style={{ "--chars": value.length, color: color ? color : "#00AA24" } as React.CSSProperties }>{value}</p>
</div>
</div>
)
}

View File

@@ -0,0 +1,35 @@
.typewriter{
display: flex;
justify-content: center;
}
.typewriter p{
--chars: 8;
font-family: monospace;
font-size: 1.5rem;
color: #00AA24;
margin-inline: auto;
overflow: hidden;
white-space: nowrap;
border-right: 1px solid;
animation: typing calc(var(--chars) * 0.07s) steps(var(--chars)) forwards,
blink 1s step-end infinite;
}
@keyframes typing {
from {
width: 0;
}
to {
width: 100%;
}
}
@keyframes blink {
50% {
border-color: transparent;
}
}