Skip to content

Commit 74784de

Browse files
committed
Added new logo, created header.tsx component, added header into page.tsx file
1 parent bb02d1e commit 74784de

File tree

4 files changed

+103
-1
lines changed

4 files changed

+103
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ yarn-error.log*
2626

2727
# local env files
2828
.env*.local
29+
.env
2930

3031
# vercel
3132
.vercel

next.config.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/** @type {import('next').NextConfig} */
2-
const nextConfig = {}
2+
const nextConfig = {
3+
images: {
4+
domains: ["res.cloudinary.com"]
5+
},
6+
}
37

48
module.exports = nextConfig

src/app/page.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Header from "@/components/header";
12
import { Button } from "@/components/ui/button";
23
import { prisma } from "@/lib/prisma";
34

@@ -6,8 +7,12 @@ export default async function Home() {
67
console.log(users);
78

89
return (
10+
<>
11+
<Header />
912
<main className="flex min-h-screen flex-col items-center justify-between p-24">
1013
<Button>Button</Button>
1114
</main>
15+
</>
16+
1217
);
1318
}

src/components/header.tsx

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
'use client'
2+
3+
import Image from 'next/image';
4+
import Link from 'next/link';
5+
import React, { useState } from 'react';
6+
import { Button } from './ui/button';
7+
8+
const Header = () => {
9+
const [state, setState] = useState(false);
10+
11+
// Replace javascript:void(0) path with your path
12+
const navigation = [
13+
{ title: 'Race', path: '/' },
14+
{ title: 'Leaderboard', path: '/' },
15+
{ title: 'About', path: '/' },
16+
];
17+
18+
return (
19+
<div>
20+
<nav className="bg-white w-full border-b md:border-0 md:static">
21+
<div className="items-center px-4 max-w-screen-xl mx-auto md:flex md:px-8">
22+
<div className="flex items-center justify-between py-3 md:py-5 md:block">
23+
<Link href="javascript:void(0)">
24+
<Image
25+
src="https://res.cloudinary.com/dfrtxrh9c/image/upload/v1688858445/Web-Dev-Cody/Logo_lvkfmp.png"
26+
width={96}
27+
height={96}
28+
alt="Code Racer Logo"
29+
/>
30+
</Link>
31+
<div className="md:hidden">
32+
<button
33+
className="text-gray-700 outline-none p-2 rounded-md focus:border-gray-400 focus:border"
34+
onClick={() => setState(!state)}
35+
>
36+
{state ? (
37+
<svg
38+
xmlns="http://www.w3.org/2000/svg"
39+
className="h-6 w-6"
40+
viewBox="0 0 20 20"
41+
fill="currentColor"
42+
>
43+
<path
44+
fillRule="evenodd"
45+
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
46+
clipRule="evenodd"
47+
/>
48+
</svg>
49+
) : (
50+
<svg
51+
xmlns="http://www.w3.org/2000/svg"
52+
className="h-6 w-6"
53+
fill="none"
54+
viewBox="0 0 24 24"
55+
stroke="currentColor"
56+
>
57+
<path
58+
strokeLinecap="round"
59+
strokeLinejoin="round"
60+
strokeWidth={2}
61+
d="M4 8h16M4 16h16"
62+
/>
63+
</svg>
64+
)}
65+
</button>
66+
</div>
67+
</div>
68+
<div
69+
className={`flex-1 justify-self-center pb-3 mt-8 md:block md:pb-0 md:mt-0 ${
70+
state ? 'block' : 'hidden'
71+
}`}
72+
>
73+
<ul className="justify-center items-center space-y-8 md:flex md:space-x-6 md:space-y-0">
74+
{navigation.map((item, idx) => {
75+
return (
76+
<li key={idx} className="text-gray-600 p-2 rounded-lg hover:bg-gray-50">
77+
<Link href={item.path}>{item.title}</Link>
78+
</li>
79+
);
80+
})}
81+
</ul>
82+
</div>
83+
<div className="hidden md:inline-block">
84+
<Button>Login</Button>
85+
</div>
86+
</div>
87+
</nav>
88+
</div>
89+
);
90+
};
91+
92+
export default Header;

0 commit comments

Comments
 (0)