-
Notifications
You must be signed in to change notification settings - Fork 9
feat: create landing page [TASK 2] [ARCHIVED] #19
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
Draft
burgerphilic18
wants to merge
8
commits into
p-society:main
Choose a base branch
from
burgerphilic18:landing-page
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
32403a3
feat: create landing page
burgerphilic18 18fff48
fix: add sidebar hamburger menu to header
burgerphilic18 379c51d
Merge branch 'main' into landing-page
iamanishx df7aa84
fix: implement suggested changes
burgerphilic18 8d93cb7
Merge branch 'main' into landing-page
burgerphilic18 636333e
fix: resolve lint warnings
burgerphilic18 447297c
Merge branch 'landing-page' of github.com:burgerphilic18/purple-face β¦
burgerphilic18 8bae88a
feat: add background images, logo, avatars
burgerphilic18 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,107 @@ | ||
| import { NavLink } from "react-router"; | ||
|
|
||
| import { ModeToggle } from "./mode-toggle"; | ||
| import React, { useState } from "react"; | ||
| import { Menu, X } from "lucide-react"; | ||
| import SidebarItem from "@/components/sidebar-item"; | ||
| import { ModeToggle } from "@/components/mode-toggle"; | ||
|
|
||
| export default function Header() { | ||
| const links = [{ to: "/", label: "Home" }]; | ||
| const [isMobileMenuOpen, setMobileMenuOpen] = useState(false); | ||
|
|
||
| return ( | ||
| <> | ||
| {/* TOP HEADER */} | ||
| <header | ||
| className="flex justify-between items-center p-4 border-b-4" | ||
| style={{ | ||
| background: "var(--surface)", | ||
| borderColor: "var(--border)", | ||
| }} | ||
| > | ||
| {/* LOGO + TEXT */} | ||
| <div className="flex items-center gap-2"> | ||
| {/* Logo Image */} | ||
| <img | ||
| src="/logo.png" // π Replace with your logo path | ||
| alt="IIITBuzz Logo" | ||
| className="h-8 w-8" // Adjust size as needed | ||
| /> | ||
| {/* Logo Text */} | ||
| <span | ||
| className="font-bold text-lg pixel-font" | ||
| style={{ color: "var(--primary)" }} | ||
| > | ||
| IIITBuzz | ||
| </span> | ||
| </div> | ||
|
|
||
| {/* Right Side (ModeToggle + Hamburger) */} | ||
| <div className="flex items-center gap-2"> | ||
| {/* Mode Toggle Dropdown (desktop & mobile) */} | ||
| <ModeToggle /> | ||
|
|
||
| {/* Hamburger Button (mobile only) */} | ||
| <button | ||
| className="md:hidden p-2 rounded border-2 pixel-font" | ||
| style={{ | ||
| background: "var(--surface)", | ||
| color: "var(--primary)", | ||
| borderColor: "var(--primary)", | ||
| }} | ||
| aria-label="Toggle Menu" | ||
| onClick={() => setMobileMenuOpen(true)} | ||
| > | ||
| <Menu size={20} /> | ||
| </button> | ||
| </div> | ||
| </header> | ||
|
|
||
| {/* MOBILE DRAWER */} | ||
| <div | ||
| className={`fixed inset-y-0 left-0 w-64 z-40 transition-transform duration-300 ease-in-out shadow-pixel | ||
| ${isMobileMenuOpen ? "translate-x-0" : "-translate-x-full"}`} | ||
| style={{ | ||
| background: "var(--surface)", | ||
| color: "var(--text-primary)", | ||
| borderRight: "4px solid var(--border)", | ||
| }} | ||
| > | ||
| {/* Drawer Header */} | ||
| <div className="flex justify-between items-center p-4 border-b-4" style={{ borderColor: "var(--border)" }}> | ||
| <div className="font-bold pixel-font" style={{ color: "var(--primary)" }}> | ||
| Menu | ||
| </div> | ||
| <button | ||
| className="p-2 rounded border-2 pixel-font" | ||
| style={{ | ||
| background: "var(--surface)", | ||
| color: "var(--primary)", | ||
| borderColor: "var(--primary)", | ||
| }} | ||
| aria-label="Close Menu" | ||
| onClick={() => setMobileMenuOpen(false)} | ||
| > | ||
| <X size={20} /> | ||
| </button> | ||
| </div> | ||
|
|
||
| {/* Drawer Navigation */} | ||
| <nav className="flex flex-col gap-2 p-4" aria-label="Mobile Navigation"> | ||
| <SidebarItem icon="π " label="Home" active /> | ||
| <SidebarItem icon="ποΈ" label="Categories" /> | ||
| <SidebarItem icon="π·οΈ" label="Tags" /> | ||
| <SidebarItem icon="π’" label="Announcements" /> | ||
| <SidebarItem icon="π" label="Leaderboard" /> | ||
| <SidebarItem icon="βΉοΈ" label="About" /> | ||
| </nav> | ||
| </div> | ||
|
|
||
| return ( | ||
| <div> | ||
| <div className="flex flex-row items-center justify-between px-2 py-1"> | ||
| <nav className="flex gap-4 text-lg"> | ||
| {links.map(({ to, label }) => { | ||
| return ( | ||
| <NavLink | ||
| key={to} | ||
| to={to} | ||
| className={({ isActive }) => (isActive ? "font-bold" : "")} | ||
| end | ||
| > | ||
| {label} | ||
| </NavLink> | ||
| ); | ||
| })} | ||
| </nav> | ||
| <div className="flex items-center gap-2"> | ||
| <ModeToggle /> | ||
| </div> | ||
| </div> | ||
| <hr /> | ||
| </div> | ||
| ); | ||
| {/* BACKDROP */} | ||
| {isMobileMenuOpen && ( | ||
| <div | ||
| className="fixed inset-0 z-30 bg-black/50" | ||
| onClick={() => setMobileMenuOpen(false)} | ||
| aria-hidden="true" | ||
| ></div> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| export default function SidebarItem({ icon, label, active = false }: { icon: string; label: string; active?: boolean }) { | ||
|
||
| return ( | ||
| <div | ||
| className={`flex items-center gap-3 px-3 py-2 rounded font-bold pixel-font text-sm cursor-pointer w-full | ||
| ${active ? "border-l-4" : "hover:bg-[var(--bg)]"} | ||
| `} | ||
| style={{ | ||
| background: active ? "var(--bg)" : "transparent", | ||
| color: active ? "var(--primary)" : "var(--text-secondary)", | ||
| borderColor: active ? "var(--primary)" : undefined, | ||
| }} | ||
| title={label} | ||
| > | ||
| <span className="text-lg flex-shrink-0">{icon}</span> | ||
| <span className="break-words">{label}</span> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The navigation links in the mobile drawer are hardcoded. This is less maintainable than defining them as a data structure (like an array of objects) and rendering them with
.map(). This approach makes it much easier to add, remove, or reorder navigation items in the future.For example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done