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

Jubaraj error #15

Closed
wants to merge 17 commits into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ jobs:
run: npm install

- name: Run ESLint
run: npm run lint
run: npm run lint
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@vitejs/plugin-react": "^4.2.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.3.0",
"react-router-dom": "^6.22.2",
"vite": "^5.1.4"
},
Expand Down
1,946 changes: 1,011 additions & 935 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Binary file added public/fonts/Death Star.otf
Binary file not shown.
Binary file added public/fonts/Outfit-Regular.ttf
Binary file not shown.
Binary file added public/images/Faq Bg.png
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/images/Team bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/images/faqcover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions public/images/hamber.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/images/teamcover.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 29 additions & 0 deletions public/images/underscore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions public/logo/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
360 changes: 360 additions & 0 deletions public/logo/nitshacks_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/logo/nitshacks_logo.webp
Binary file not shown.
184 changes: 183 additions & 1 deletion src/Components/Navbar/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,188 @@
import { useEffect, useState } from "react";
import { useNavigate, useLocation } from "react-router-dom";
import styles from "./Navbar.module.scss";

const Navbar = () => {
return <nav className={styles.navbar}>Navbar</nav>;
const [hamOpen, setHamOpen] = useState(false);
const navigate = useNavigate();
const currPage = window.location.pathname;
const location = useLocation();

useEffect(() => {
if (location.hash) {
const id = location.hash.split("#")[1];
const element = document.getElementById(id);
const headerOffset = 100;
const bodyRect = document.body.getBoundingClientRect().top;
if (element) {
const elementRect = element.getBoundingClientRect().top;
const elementPosition = elementRect - bodyRect;
const offsetPosition = elementPosition - headerOffset;
window.scrollTo({
top: offsetPosition,
behavior: "smooth",
});
}
}
}, [location]);

useEffect(() => {
const navMap = new Map([
["/", 0],
["/faq", 2],
["/team", 4],
]);
const curr = navMap.get(currPage);
const links = document.querySelectorAll(`.${styles.deskNav}`);
const underscores = document.querySelectorAll(".underscore");
const latches = document.querySelectorAll(".latch");

links.item(curr).classList.add(styles.hovereffect);
underscores.item(curr).classList.add(styles.hoverUnder);
latches.item(curr).classList.add(styles.glow);
links.forEach((link, index) => {
link.addEventListener("mouseleave", () => {
links.forEach((linksm, niggdex) => {
linksm.classList.remove(styles.hovereffect);
underscores.item(niggdex).classList.remove(styles.hoverUnder);
});
links.item(curr).classList.add(styles.hovereffect);
underscores.item(curr).classList.add(styles.hoverUnder);
});
link.addEventListener("mouseenter", () => {
link.classList.add(styles.hovereffect);
underscores.item(index).classList.add(styles.hoverUnder);
links.forEach((linksm, niggdex) => {
if (niggdex !== index) {
linksm.classList.remove(styles.hovereffect);
underscores.item(niggdex).classList.remove(styles.hoverUnder);
}
});
});
});
}, [currPage]);

return (
<nav className={styles.navbar}>
<div className={styles.bar}>
<div className={styles.bigScn}>
<div className={styles.logo}>
<a href="/">
<img src="/logo/nitshacks_logo.svg" height={40} width={100} alt="logo" />
</a>
</div>
<div className={styles.pages}>
<div>
<button
className={styles.deskNav}
onClick={() => {
navigate("/");
}}
>
<p>Home</p>
<img alt="glow" src="/images/underscore.svg" className="underscore" />
</button>
</div>
<div>
<button
className={styles.deskNav}
onClick={() => {
navigate("/#events");
}}
>
<p>events</p>
<img alt="glow" src="/images/underscore.svg" className="underscore" />
</button>
</div>
<div>
<button
className={styles.deskNav}
onClick={() => {
navigate("/faq");
}}
>
<p>Faq</p>
<img alt="glow" src="/images/underscore.svg" className="underscore" />
</button>
</div>
<div>
<button
className={styles.deskNav}
onClick={() => {
navigate("/#sponsors");
}}
>
<p>SponsorS</p>
<img alt="glow" src="/images/underscore.svg" className="underscore" />
</button>
</div>
<div>
<button
className={styles.deskNav}
onClick={() => {
navigate("/team");
}}
>
<p>team</p>
<img alt="glow" src="/images/underscore.svg" className="underscore" />
</button>
</div>
</div>
</div>
<div className={styles.smallScn}>
<div className={styles.logo}>
<a href="/">
<img src="/logo/nitshacks_logo.svg" alt="logo" />
</a>
</div>
<button
onClick={() => {
setHamOpen(!hamOpen);
}}
className={`${styles.ham} ${hamOpen ? styles.open : ""}`}
>
<img alt="glow" src="/images/hamber.svg" className="" />
<img alt="glow" src="/images/hamber.svg" className="" />
<img alt="glow" src="/images/hamber.svg" className="" />
</button>
</div>
</div>
<section className={`${styles.mobileView} ${hamOpen ? styles.open : ""}`}>
<Latch setHam={setHamOpen} link="/">
Home
</Latch>
<Latch setHam={setHamOpen} link="/#events">
Events
</Latch>
<Latch setHam={setHamOpen} link="/faq">
Faq
</Latch>
<Latch setHam={setHamOpen} link="/#sponsors">
Sponsors
</Latch>
<Latch setHam={setHamOpen} link="/team">
Team
</Latch>
</section>
</nav>
);
};

export default Navbar;

const Latch = ({ children, link, setHam }) => {
const navigate = useNavigate();
return (
<button
onClick={() => {
setHam(false);
navigate(link);
}}
>
<p style={{ color: "#494949" }} className="latch">
{children}
</p>
<span className={styles.latch}></span>
</button>
);
};
Loading
Loading