Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar #24

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
931 changes: 928 additions & 3 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@
"lint": "next lint"
},
"dependencies": {
"next": "14.0.4",
"react": "^18",
"react-dom": "^18",
"next": "14.0.4"
"react-dom": "^18"
},
"devDependencies": {
"@types/node": "20.12.12",
"@types/react": "18.3.3",
"eslint": "^8",
"eslint-config-next": "14.0.4"
"eslint-config-next": "14.0.4",
"tailwindcss": "^3.4.3"
}
}
9 changes: 9 additions & 0 deletions src/app/(auth)/login/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const LoginPage = () => {
return (
<div>LoginPage</div>
)
}

export default LoginPage
9 changes: 9 additions & 0 deletions src/app/about/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const AboutPage = () => {
return (
<div>AboutPage</div>
)
}

export default AboutPage
9 changes: 9 additions & 0 deletions src/app/admin/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const AdminPage = () => {
return (
<div>AdminPage</div>
)
}

export default AdminPage
9 changes: 9 additions & 0 deletions src/app/blog/[slug]/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const SingelPostPage = () => {
return (
<div>SingelPostPage</div>
)
}

export default SingelPostPage
9 changes: 9 additions & 0 deletions src/app/blog/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const BlogPage = () => {
return (
<div>BlogPage</div>
)
}

export default BlogPage
9 changes: 9 additions & 0 deletions src/app/contact/page.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const ContactPage = () => {
return (
<div>ContactPage</div>
)
}

export default ContactPage
12 changes: 12 additions & 0 deletions src/app/error.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use client"
"use modules"

// use to indicate an error if something wen wrong

const Error = () => {
return (
<div>Error</div>
)
}

export default Error
36 changes: 36 additions & 0 deletions src/app/globals.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@

:root {
--bg: #0d0c22;
--bgSoft: #2d2b42;
--text: white;
--textSoft: #e5e5e5;
--btn: #3673fd;
}

* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

body {
background-color: var(--bg);
color: var(--text);
}

a {
text-decoration: none;
color: inherit;
}

.container {
/*background-color: rebeccapurple;*/
width: 1300px;
margin: auto;
padding: 0 50px 0 50px;
min-height: 100vh;
display: flex;
flex-direction: column;
flex-direction: column;
justify-content: space-between;
}
10 changes: 9 additions & 1 deletion src/app/layout.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Inter } from 'next/font/google'
import './globals.css'
import Navbar from '@/components/navbar/navbar'
import Footer from '@/components/footer/Footer'

const inter = Inter({ subsets: ['latin'] })

Expand All @@ -11,7 +13,13 @@ export const metadata = {
export default function RootLayout({ children }) {
return (
<html lang="en">
<body className={inter.className}>{children}</body>
<body className={inter.className}>
<div className='container'>
<Navbar />
{children}
<Footer />
</div>
</body>
</html>
)
}
10 changes: 10 additions & 0 deletions src/app/loading.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import React from 'react'
// use to make a loading screen between pages

const Loading = () => {
return (
<div>Loading</div>
)
}

export default Loading
14 changes: 14 additions & 0 deletions src/app/not-found.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import Link from 'next/link'
import React from 'react'

const NotFound = () => {
return (
<div>
<h2>Page Not Found</h2>
<p>Sorry, the page you are looking for does not exist.</p>
<Link href="/">Return Home</Link>
</div>
)
}

export default NotFound
2 changes: 1 addition & 1 deletion src/app/page.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const Home = () => {
return <div>Hello World!</div>;
return <div>Hello Page</div>;
};

export default Home;
9 changes: 9 additions & 0 deletions src/components/footer/Footer.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

const Footer = () => {
return (
<div>Footer</div>
)
}

export default Footer
17 changes: 17 additions & 0 deletions src/components/navbar/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import Links from './links/Links'
import styles from './navbar.module.css'

const Navbar = () => {

return (
<div className={styles.container}>
<div className={styles.logo}>Logo</div>
<div>
<Links />
</div>
</div>
)
}

export default Navbar
49 changes: 49 additions & 0 deletions src/components/navbar/links/Links.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from 'react'
import Link from "next/link"
import styles from "./links.module.css"
import "./navLink/NavLink.jsx"
import NavLink from './navLink/NavLink.jsx'

const Links = () => {

const links = [
{
titles: "Homepage",
path: "/",
},
{
titles: "About",
path: "/about",
},
{
titles: "Contact",
path: "/contact",
},
{
titles: "Blog",
path: "/blog",
},
];

// Temporary
const session = true
const isAdmin = true

return (
<div className={styles.links}>
{links.map((link => (
<NavLink item={link} key={link.titles} />
)))}
{session ? (
<>
{isAdmin && <NavLink item={{title:"Login", path:"/login"}} />}
<button>Logout</button>
</>
) : (
<NavLink item={{title:"Login", path:"/login"}} />
)}
</div>
)
}

export default Links
6 changes: 6 additions & 0 deletions src/components/navbar/links/links.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.links {
display: flex;
align-items: center;
gap: 10px;
}
18 changes: 18 additions & 0 deletions src/components/navbar/links/navLink/NavLink.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use client";

import { usePathname } from "next/navigation"
import styles from "./navLink.module.css"
import Link from "next/link"


const NavLink = ({item}) => {

const pathName = usePathname();

return (
<Link href={item.path} className={`${styles.container} ${pathName === item.path && styles.active}`}>
{item.titles}
</Link>)
}

export default NavLink
13 changes: 13 additions & 0 deletions src/components/navbar/links/navLink/navLink.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

.container {
min-width: 100px;
padding: 10px;
border-radius: 20px;
font-weight: 500;
text-align: center;
}

.active {
background-color: var(--text);
color: var(--bg);
}
12 changes: 12 additions & 0 deletions src/components/navbar/navbar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

.container {
height: 100px;
display: flex;
align-items: center;
justify-content: space-between;
}

.logo {
font-size: 30px;
font-weight: bold;
}
14 changes: 14 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js,ts,jsx,tsx}",
"./pages/**/*.{js,ts,jsx,tsx,mdx}",
"./components/**/*.{js,ts,jsx,tsx,mdx}",
"./app/**/*.{js,ts,jsx,tsx,mdx}",
],
theme: {
extend: {},
},
plugins: [],
}

export default Config;