Skip to content

Commit 139860d

Browse files
committed
animated cursor
Fixes #18
1 parent 2e47253 commit 139860d

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

src/components/LetterCard.tsx

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,45 @@ function styleLetterCard(
3131
): Record<string, any> {
3232
const color = styleColor(letter);
3333
const backgroundColor = styleBackgroundColor(letter, isHighlight, isCurrent);
34+
/*
3435
let borderLeft = "";
3536
3637
if (isCurrent) {
3738
borderLeft = "1px solid white";
3839
}
40+
*/
41+
42+
let before = {};
43+
44+
if (isCurrent) {
45+
before = {
46+
content: "''",
47+
width: "2px",
48+
height: "100%",
49+
background: "#ec7fff",
50+
position: "absolute",
51+
left: "0px",
52+
animation: "cursor-blink 0.8s infinite",
53+
};
54+
}
3955

4056
return {
57+
position: "relative",
4158
color,
42-
borderLeft,
59+
// borderLeft,
4360
backgroundColor,
4461
fontSize: "28px",
4562
fontFamily: "monospace",
4663
whiteSpace: "pre",
64+
padding: "0 3px",
65+
"::before": {
66+
...before,
67+
},
68+
"@keyframes cursor-blink": {
69+
"0%": { background: "transparent" },
70+
"50%": { background: "#ff963a" },
71+
"100%": { background: "transparent" },
72+
},
4773
};
4874
}
4975

0 commit comments

Comments
 (0)