Skip to content

Commit

Permalink
Merge pull request #42 from ComputerSocietyVITC/navbar
Browse files Browse the repository at this point in the history
Navbar
  • Loading branch information
a2ys authored Aug 8, 2024
2 parents f235bec + c75e8d1 commit 85f087e
Show file tree
Hide file tree
Showing 9 changed files with 4,205 additions and 110 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@radix-ui/react-accordion": "^1.2.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"framer-motion": "^11.3.23",
"install": "^0.13.0",
"lucide-react": "^0.408.0",
"next": "14.2.4",
Expand Down
4,008 changes: 4,008 additions & 0 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Navbar from "../components/navbar/Navbar";
import Footer from "../components/footer/Footer";
import type { Metadata } from "next";
import "./globals.css";
import Navbar from "@/components/navbar/Navbar";

export const metadata: Metadata = {
title: "Bitwars-24",
Expand Down
48 changes: 26 additions & 22 deletions src/components/buttons/IconButton.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
import React from 'react';
import Link from 'next/link';
import Image from 'next/image';
import React from "react";
import Link from "next/link";
import Image from "next/image";

interface IconButtonProps {
href: string;
src: string;
alt: string;
width?: number;
height?: number;
href: string;
src: string;
alt: string;
width?: number;
height?: number;
}

const IconButton: React.FC<IconButtonProps> = ({ href, src, alt, width, height }) => {
return (
<>
<Link href={href}>
<Image
src={src}
alt={alt}
width={width}
height={height}
className="relative"
/>
</Link>
</>
);
const IconButton: React.FC<IconButtonProps> = ({
href,
src,
alt,
width,
height,
}) => {
return (
<Link href={href}>
<Image
src={src}
alt={alt}
width={width}
height={height}
className="relative"
/>
</Link>
);
};

export default IconButton;
22 changes: 22 additions & 0 deletions src/components/buttons/NavButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import Link from "next/link";

interface NavButtonProps {
href: string;
children: React.ReactNode;
}

const NavButton: React.FC<NavButtonProps> = ({ href, children }) => {
return (
<Link
href={href}
className="inline-block mx-6 font-medium text-white transition-all duration-300 ease-in-out group"
>
<span className="bg-left-bottom bg-gradient-to-r from-sky-600 to-sky-600 bg-[length:0%_2px] bg-no-repeat group-hover:bg-[length:100%_2px] transition-all duration-500 ease-out">
{children}
</span>
</Link>
);
};

export default NavButton;
4 changes: 2 additions & 2 deletions src/components/buttons/TextButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import Link from 'next/link';
import React from "react";
import Link from "next/link";

interface TextButtonProps {
href: string;
Expand Down
27 changes: 27 additions & 0 deletions src/components/data/navLinks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export interface Route {
href: string;
title: string;
}

export const navLinks: Route[] = [
{
title: "About",
href: "#about",
},
{
title: "Our Team",
href: "#team",
},
{
title: "Events",
href: "#events",
},
{
title: "Sponsors",
href: "#sponsors",
},
{
title: "FAQ",
href: "#faq",
},
];
19 changes: 16 additions & 3 deletions src/components/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ const Footer = () => {
{/* Menu */}
<div className="space-y-4 mt-10 flex flex-col justify-center items-center basis-1/6">
<h3 className="text-xl font-semibold items-center md:text-left">
Menu
<div className="relative">
Menu
<hr className="absolute w-full h-1 border-transparent bg-gradient-to-r from-transparent via-[#114554]" />
</div>
</h3>
<ul className="space-y-2 text-center md:text-left">
<TextButton href="#about">About</TextButton>
Expand All @@ -47,7 +50,12 @@ const Footer = () => {

{/* VITC address */}
<div className="space-y-4 flex items-center flex-col justify-center basis-1/5 mt-10">
<h3 className="text-xl font-semibold">Address</h3>
<h3 className="text-xl font-semibold">
<div className="relative">
Address
<hr className="absolute w-full h-1 border-transparent bg-gradient-to-r from-transparent via-[#114554]" />
</div>
</h3>
<p className="text-center lg:text-left">
Kelambakkam - Vandallur
<br />
Expand All @@ -60,7 +68,12 @@ const Footer = () => {

{/* Social Media */}
<div className="space-y-4 flex flex-col text-center md:text-left justify-center items-center mt-10">
<h3 className="text-xl font-semibold">Social Media</h3>
<h3 className="text-xl font-semibold">
<div className="relative">
Social Media
<hr className="absolute w-full h-1 border-transparent bg-gradient-to-r from-transparent via-[#114554]" />
</div>
</h3>
<SocialMediaGrid />
</div>
</div>
Expand Down
184 changes: 102 additions & 82 deletions src/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
@@ -1,82 +1,102 @@
"use client";
import React, { useState } from "react";
import TextButton from "../buttons/TextButton";
import IconButton from "../buttons/IconButton";
import { Montserrat } from "next/font/google";
import Sidebar from "../ui/sidebar";

const montserrat = Montserrat({ subsets: ["latin"] });

const Navbar = () => {
const [isDropdownOpen, setIsDropdownOpen] = useState(false);

const handleDropdownToggle = () => {
setIsDropdownOpen(!isDropdownOpen);
};

return (

<div className={`${montserrat.className} w-full top-0 p-4 z-50`}>
<div className="w-full h-20">
<div className="container mx-auto px-4 h-full">
<div className="flex justify-between items-center h-20">
<IconButton
href="/"
src="/logo.png"
alt="Logo"
width={48}
height={48}
/>
<button
type="button"
className="inline-flex items-center md:hidden"
onClick={handleDropdownToggle}
>
<svg
xmlns="http://www.w3.org/2000/svg"
width="40"
height="40"
viewBox="0 0 24 24"
>
<path
fill="#fff"
d="M3 6h18v2H3V6m0 5h18v2H3v-2m0 5h18v2H3v-2Z"
/>
</svg>
<Sidebar />
{/* {isDropdownOpen && (
<ul className="absolute right-0 w-48 bg-white text-black rounded shadow-lg">
<li>
<TextButton href="#about">About Us</TextButton>
</li>
<li>
<TextButton href="#team">Our Team</TextButton>
</li>
<li>
<TextButton href="#events">Events</TextButton>
</li>
<li>
<TextButton href="#sponsors">Sponsors</TextButton>
</li>
<li>
<TextButton href="#faq">FAQs</TextButton>
</li>
</ul>
)} */}
</button>
<ul className="hidden md:flex gap-x-16 text-white ">
<TextButton href="#about">About Us</TextButton>
<TextButton href="#team">Our Team</TextButton>
<TextButton href="#events">Events</TextButton>
<TextButton href="#sponsors">Sponsors</TextButton>
<TextButton href="#faq">FAQs</TextButton>
</ul>
<div className="hidden md:block"></div>
</div>
</div>
</div>
</div>
);
};

export default Navbar;
"use client";
import React, { useState } from "react";
import { navLinks, Route } from "../data/navLinks";
import Image from "next/image";
import { motion } from "framer-motion";
import NavButton from "../buttons/NavButton";
import { Montserrat } from "next/font/google";

const montserrat = Montserrat({ subsets: ["latin"] });

const Navbar = () => {
const [isOpen, setIsOpen] = useState(false);

const handleClick = () => {
setIsOpen(!isOpen);
};

return (
<div
className={`${montserrat.className} px-6 py-4 lg:px-8 lg:py-6 flex justify-between items-center relative z-50`}
>
{isOpen && (
<section
onClick={handleClick}
className="fixed top-0 left-0 flex flex-col items-center justify-center h-screen w-screen z-50 backdrop-blur-2xl"
>
<motion.section
initial={{ opacity: 0 }}
animate={{
opacity: 1,
}}
transition={{
duration: 0.3,
delay: 0,
ease: "easeInOut",
}}
exit={{ opacity: 0 }}
className="backdrop-blur-2xl shadow-slate-300 border border-white/[0.4] shadow-2xl flex flex-col items-center justify-center rounded-2xl py-4 px-8"
>
{navLinks.map((route: Route, index: number) => (
<a key={index} href={route.href}>
<section
onClick={handleClick}
className={`px-16 py-6 text-white hover:bg-black hover:bg-opacity-5 rounded-xl`}
id={route.title}
>
{route.title}
</section>
</a>
))}
</motion.section>
</section>
)}

<a href="/">
<Image src="/logo.png" alt="IEEE Logo" width={48} height={48} />
</a>

<nav className="lg:hidden">
<button
onClick={handleClick}
className="flex flex-col justify-center items-center py-1"
>
<span
className={`bg-slate-400 block transition-all duration-300 ease-out
h-0.5 w-6 rounded-sm ${
isOpen
? "rotate-45 translate-y-1"
: "-translate-y-0.5"
}`}
></span>
<span
className={`bg-slate-400 block transition-all duration-300 ease-out
h-0.5 w-6 rounded-sm my-0.5 ${
isOpen ? "opacity-0" : "opacity-100"
}`}
></span>
<span
className={`bg-slate-400 block transition-all duration-300 ease-out
h-0.5 w-6 rounded-sm ${
isOpen
? "-rotate-45 -translate-y-1"
: "translate-y-0.5"
}`}
></span>
</button>
</nav>

<nav className="hidden lg:block">
{navLinks.map((route: Route, index: number) => (
<NavButton key={index} href={route.href}>
{route.title}
</NavButton>
))}
</nav>

<div className="hidden lg:block"></div>
</div>
);
};

export default Navbar;

0 comments on commit 85f087e

Please sign in to comment.