Skip to content

Commit c470611

Browse files
committed
chore: add a race page
1 parent e86b08e commit c470611

File tree

4 files changed

+28
-15
lines changed

4 files changed

+28
-15
lines changed

src/app/race/page.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import TypingCode from "@/components/typing/typingCode";
2+
3+
export default async function Race() {
4+
return (
5+
<>
6+
<main className="flex min-h-screen flex-col items-center justify-between p-24">
7+
<TypingCode />
8+
</main>
9+
</>
10+
);
11+
}

src/components/header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const Header = () => {
1010
const [state, setState] = useState(false);
1111

1212
const navigation = [
13-
{ title: "Race", path: "/" },
13+
{ title: "Race", path: "/race" },
1414
{ title: "Leaderboard", path: "/" },
1515
{ title: "About", path: "/" },
1616
];
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react'
1+
import React from "react";
22

33
interface displayCodeProps {
44
code: string;
@@ -8,16 +8,16 @@ interface displayCodeProps {
88
export default function DisplayedCode({ code, errors }: displayCodeProps) {
99
return (
1010
<p className="text-gray-600 mb-4">
11-
{code.split("").map((char, index) => (
12-
<span
13-
key={index}
14-
className={`${
15-
errors.includes(index) ? "text-red-500" : "opacity-100"
16-
}`}
17-
>
18-
{char}
19-
</span>
20-
))}
21-
</p>
22-
)
11+
{code.split("").map((char, index) => (
12+
<span
13+
key={index}
14+
className={`${
15+
errors.includes(index) ? "text-red-500" : "opacity-100"
16+
}`}
17+
>
18+
{char}
19+
</span>
20+
))}
21+
</p>
22+
);
2323
}

src/components/typing/typingCode.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
"use client";
2+
23
import { useState, useEffect } from "react";
4+
35
import DisplayedCode from "./displayedCode";
46

5-
const code = 'printf("hello world")';
7+
const code = `printf("hello world")`;
68

79
export default function TypingCode() {
810
const [input, setInput] = useState("");

0 commit comments

Comments
 (0)