Skip to content

Commit 1223433

Browse files
committed
feat: add title typing animation
1 parent ab9a79e commit 1223433

File tree

3 files changed

+118
-4
lines changed

3 files changed

+118
-4
lines changed

src/pages/TimerCountdown.page.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { createRef, useCallback, useMemo } from "react";
22
import { useState, useEffect } from "react";
33
import { useLocation, useNavigate } from "react-router-dom";
4-
54
import routes from "../routes";
65
import BitButton from "../components/BitButton.component";
76
import BitCounter from "../BitCounter";

src/pages/TimerSetup.module.css

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
.typewriter h1 {
2+
border-right: .15em solid var(--caret);
3+
}
4+
5+
.typewriter {
6+
--caret: currentcolor;
7+
}
8+
9+
.typewriter::before {
10+
content: "";
11+
animation: typing 1s forwards;
12+
}
13+
14+
.typewriter::after {
15+
content: "";
16+
border-right: 1.5rem solid var(--caret);
17+
margin-left: .5rem;
18+
animation: blink 1.5s steps(2) infinite;
19+
}
20+
21+
@keyframes typing {
22+
0% {
23+
content: "";
24+
}
25+
26+
5% {
27+
content: "1";
28+
}
29+
30+
10% {
31+
content: "12";
32+
}
33+
34+
15% {
35+
content: "12-";
36+
}
37+
38+
20% {
39+
content: "12-b";
40+
}
41+
42+
25% {
43+
content: "12-bi";
44+
}
45+
46+
30% {
47+
content: "12-bit";
48+
}
49+
50+
35% {
51+
content: "12-bit ";
52+
}
53+
54+
40% {
55+
content: "12-bit b";
56+
}
57+
58+
45% {
59+
content: "12-bit bi";
60+
}
61+
62+
50% {
63+
content: "12-bit bin";
64+
}
65+
66+
55% {
67+
content: "12-bit bina";
68+
}
69+
70+
60% {
71+
content: "12-bit binar";
72+
}
73+
74+
65% {
75+
content: "12-bit binary";
76+
}
77+
78+
70% {
79+
content: "12-bit binary ";
80+
}
81+
82+
75% {
83+
content: "12-bit binary t";
84+
}
85+
86+
80% {
87+
content: "12-bit binary ti";
88+
}
89+
90+
85% {
91+
content: "12-bit binary tim";
92+
}
93+
94+
90% {
95+
content: "12-bit binary time";
96+
}
97+
98+
100% {
99+
content: "12-bit binary timer";
100+
}
101+
}
102+
103+
@keyframes blink {
104+
105+
0% {
106+
opacity: 0;
107+
}
108+
}
109+
110+
@media (prefers-reduced-motion) {
111+
.typewriter::after {
112+
animation: none;
113+
}
114+
}

src/pages/TimerSetup.page.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import { createRef, useMemo } from "react";
22
import { useEffect, useState } from "react";
33
import { useNavigate } from "react-router-dom";
4-
54
import { faPlay } from "@fortawesome/free-solid-svg-icons";
6-
75
import { Button, ButtonType } from "../components/Button.component";
86
import BitButton from "../components/BitButton.component";
97
import BitCounter from "../BitCounter";
8+
import styles from "./TimerSetup.module.css";
109

1110
function TimerSetup() {
1211
const navigate = useNavigate();
@@ -63,7 +62,9 @@ function TimerSetup() {
6362

6463
return (
6564
<div className="flex flex-col items-center justify-center text-center">
66-
<h1 className="text-5xl uppercase mb-8">12-bit Binary timer</h1>
65+
<h1 className="text-5xl uppercase mb-8">
66+
<span className={styles.typewriter} />
67+
</h1>
6768
<div className="flex flex-row justify-center align-center flex-wrap mt-8">
6869
{selectedBits.map((_, index) => (
6970
<BitButton

0 commit comments

Comments
 (0)