Skip to content

Commit

Permalink
Feature: Header navigation component (#13)
Browse files Browse the repository at this point in the history
* Create initial navbar for app layout

* Add basic navbar styles and social link

* Add logos and links for GitHub and LinkedIn

* Add all social links and use lists to render all logos

* Change font-weight of Navbar links to be 700 explicitly

* Delete unnecessary comments from Navbar.module.css

* Rename logo images to end in _logo and update references

* Move links data in navbar.tsx outside of component
  • Loading branch information
Brian-Magnuson authored Oct 25, 2023
1 parent 51f5471 commit 4223944
Show file tree
Hide file tree
Showing 9 changed files with 129 additions and 1 deletion.
1 change: 1 addition & 0 deletions public/discord_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/github_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/instagram_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/linkedin_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/ssd_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/youtube_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions src/app/Navbar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.navbar {
background: rgba(0, 0, 0, 0.2);
padding: 10px;
display: flex;
align-items: center;
gap: 20px;
}

.navbar nav {
display: flex;
gap: 10px;
}

.navbar a {
font-size: 1.3rem;
font-weight: 700;
}

.navbar a:hover,
.pageLinkOpen {
text-decoration: underline;
text-decoration-thickness: 2px;
text-underline-offset: 5px;
}

.socialLinks {
margin-left: auto;
margin-right: 10px;
display: flex;
gap: 12px;
align-items: center;
}

.socialLinks img:hover {
transform: scale(1.05);
}
7 changes: 6 additions & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import "./globals.css";
import type { Metadata } from "next";
import { Poppins } from "next/font/google";

import Navbar from "./navbar";

const font = Poppins({
weight: ["400", "700"],
subsets: ["latin"],
Expand All @@ -19,7 +21,10 @@ export default function RootLayout({
}) {
return (
<html lang="en">
<body className={font.className}>{children}</body>
<body className={font.className}>
<Navbar />
{children}
</body>
</html>
);
}
81 changes: 81 additions & 0 deletions src/app/navbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"use client";

import React from "react";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import styles from "./Navbar.module.css";

const pageLinksData = [
{
name: "Home",
url: "/",
},
{
name: "About",
url: "/about",
},
];

const socialLinksData = [
{
name: "Discord",
url: "https://discord.gg/5SyB3yx",
icon: "/discord_logo.svg",
},
{
name: "GitHub",
url: "https://github.com/ufssd",
icon: "/github_logo.svg",
},
{
name: "LinkedIn",
url: "https://www.linkedin.com/company/ssduf",
icon: "/linkedin_logo.png",
},
{
name: "YouTube",
url: "https://www.youtube.com/@ufssd",
icon: "/youtube_logo.png",
},
{
name: "Instagram",
url: "https://www.instagram.com/uf.ssd/",
icon: "/instagram_logo.svg",
},
];

export default function Navbar() {
const pathname = usePathname();

const pageLinks = pageLinksData.map((link) => (
<Link
key={link.name}
href={link.url}
className={pathname === link.url ? styles.pageLinkOpen : ""}
>
{link.name}
</Link>
));

const socialLinks = socialLinksData.map((link) => (
<a
key={link.name}
target="_blank"
rel="noopener noreferrer"
href={link.url}
>
<Image src={link.icon} alt={`${link.name} Logo`} width="32" height="32" />
</a>
));

return (
<header className={styles.navbar}>
<Link href="/">
<Image src="/ssd_logo.svg" alt="SSD Logo" width="50" height="50" />
</Link>
<nav>{pageLinks}</nav>
<div className={styles.socialLinks}>{socialLinks}</div>
</header>
);
}

0 comments on commit 4223944

Please sign in to comment.