Skip to content

Commit

Permalink
feat: space-time menubar
Browse files Browse the repository at this point in the history
  • Loading branch information
bhoopesh369 committed Dec 23, 2023
1 parent dbfd485 commit 7fa110e
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 52 deletions.
11 changes: 11 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import './globals.css';
import type { Metadata } from 'next';
import content from '@/components/AboutCard/AboutContent.json';
import Toast from '@/components/Toast/Toast';
import Script from 'next/script';

export const metadata: Metadata = {
title: "Pragyan '24 | Let's Celebrate Technology",
Expand All @@ -13,6 +14,16 @@ export default function RootLayout({ children }: { children: React.ReactNode })
return (
<html lang="en">
<body>
{/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */}
<Script
src="https://cdnjs.cloudflare.com/ajax/libs/three.js/r121/three.min.js"
strategy="beforeInteractive"
></Script>
{/* eslint-disable-next-line @next/next/no-before-interactive-script-outside-document */}
<Script
src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.dots.min.js"
strategy="beforeInteractive"
></Script>
<div className="w-full min-h-screen bg-[#070B12] page-layout">{children}</div>
<Footer />
<Toast />
Expand Down
128 changes: 79 additions & 49 deletions src/components/Menu/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';
import React, { useEffect, useState } from 'react';
import Image from 'next/image';
// import Image from 'next/image';
import Link from 'next/link';
import MenuItem from '@/components/MenuItem/MenuItem';
import disk from '../../assets/images/disk.png';
import diskglow from '../../assets/images/diskglow.png';
// import disk from '../../assets/images/disk.png';
// import diskglow from '../../assets/images/diskglow.png';
import styles from '../NavBar/navbar.module.css';

interface MenuProps {
Expand Down Expand Up @@ -35,57 +35,87 @@ const Menu: React.FC<MenuProps> = ({ isOpened, setIsOpened }) => {
{ name: 'Campus', link: '/campus' },
];

return (
<div>
{isOpened ? (
<div className="flex w-full justify-center items-center absolute z-[1000] top-0 left-0 bg-black">
<div
className="absolute top-[2rem] right-[2rem] z-[1001] text-white text-3xl hover:cursor-pointer font-Orbitron"
onClick={() => {
if (setIsOpened) setIsOpened(false);
}}
>
X
</div>
<Image
src={disk}
alt="disk"
className="absolute bottom-4 lg:bottom-0"
id={styles.disk}
/>
<Image
src={diskglow}
alt="diskglow"
className="absolute bottom-4"
id={styles.glow}
/>
useEffect(() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
if (window.innerWidth > 1024 && window.VANTA)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
window.VANTA.DOTS({
el: '#waves',
mouseControls: true,
touchControls: true,
gyroControls: false,
minHeight: 250.0,
minWidth: 200.0,
scale: 1.0,
scaleMobile: 1.0,
loading: false,
color: 0xa4ff,
color2: 'rgba(0, 0, 0, 0)',
backgroundColor: 0x0,
size: 3.4,
spacing: 25.0,
waveSpeed: 5,
});
});

return (
<>
<div>
{isOpened ? (
<div
className=" lg:top-1/5 absolute w-full lg:h-3/4 h-full"
id={styles.menubg}
/>
<ul
className=" md:flex w-full font-Orbitron flex lg:flex-row flex-col justify-evenly items-center pb-24 md:[40vh%] min-h-screen text-white"
id={styles.mainContent}
className="flex w-full justify-center items-center absolute z-[1000] top-0 left-0 bg-black"
id="waves"
>
{menuItems.map((item, index) => (
<li className={styles.li} key={index}>
<Link href={item.link}>
<MenuItem name={item.name} phone={width < 1020} />
</Link>
</li>
))}
</ul>
<style>
{`
<div
className="absolute top-[2rem] right-[2rem] z-[1001] text-white text-3xl hover:cursor-pointer font-Orbitron"
onClick={() => {
if (setIsOpened) setIsOpened(false);
}}
>
X
</div>
{/* <Image
src={disk}
alt="disk"
className="absolute bottom-4 lg:bottom-0"
id={styles.disk}
/>
<Image
src={diskglow}
alt="diskglow"
className="absolute bottom-4"
id={styles.glow}
/> */}
<div
className={
styles.menubg + ' lg:top-1/5 absolute w-full lg:h-3/4 h-full'
}
/>
<ul
className=" md:flex w-full font-Orbitron flex lg:flex-row flex-col justify-evenly items-center pb-24 md:[40vh%] min-h-screen text-white"
id={styles.mainContent}
>
{menuItems.map((item, index) => (
<li className={styles.li} key={index}>
<Link href={item.link}>
<MenuItem name={item.name} phone={width < 1020} />
</Link>
</li>
))}
</ul>
<style>
{`
`}
</style>
</div>
) : (
''
)}
</div>
</style>
</div>
) : (
''
)}
</div>
</>
);
};

Expand Down
6 changes: 3 additions & 3 deletions src/components/NavBar/navbar.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
0 0 40px #fff;
}

#menubg {
/* #menubg {
background: url('../../assets/images/menubg.png') no-repeat;
background-size: fill;
animation: fadeInLast 3s ease-in-out;
}
} */

@keyframes fall {
0% {
Expand Down Expand Up @@ -128,7 +128,7 @@
} */

@media (max-width: 1020px) {
#menubg {
.menubg {
background: url('../../assets/images/bgphone.png') no-repeat;
background-size: contain;
animation: fadeInMobile 1.2s ease-out;
Expand Down

0 comments on commit 7fa110e

Please sign in to comment.