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

fade effects #62

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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
86 changes: 76 additions & 10 deletions src/app/components/Homepage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,58 @@ import home2 from "../image/home2.png";
import ari from "../image/ari.jpg";
import Ozmo from "../image/Ozmo.png";
import irc from "../image/irc.png";
import Explore from "../image/Explore.png";
import Footer from "../image/Footer.png";
import text1 from "../image/text1.png";
import text4 from "../image/text4.png";
import text3 from "../image/text3.png";
import lovin from "../image/lovin.jpg";
import Sponsors from "../image/Sponsors.png";
import ASL from "../image/ASL.jpg";
import home from "../image/home.png";
import magic from "../image/magic.png";
import React, { useEffect, useState } from "react";
import Navbar from "./Navbar";


const Homepage = () => {

window.addEventListener('scroll', function() {
var home = document.getElementById('home');
if (home) {
if (window.scrollY < 50) {
home.classList.add('opacity-100');
home.classList.remove('opacity-0');
}
if (window.scrollY > 50 && window.scrollY < 150) {
home.classList.add('opacity-75');
home.classList.remove('opacity-100');
}
if(window.scrollY > 150 && window.scrollY < 200) {
home.classList.add('opacity-50');
home.classList.remove('opacity-75');
home.classList.remove('opacity-100');
}
if (window.scrollY > 200 && window.scrollY < 300) {
home.classList.add('opacity-25');
home.classList.remove('opacity-50');
home.classList.remove('opacity-100');
}
if (window.scrollY > 300) {
home.classList.add('opacity-0');
home.classList.remove('opacity-25');
home.classList.remove('opacity-100');
}
if (window.scrollY > 600) {
home.classList.remove('opacity-0');
home.classList.add('opacity-100');
}
}
});

return (
<div >
<section className="text-gray-400 body-font bg-cover min-h-screen grid place-item-center">
<div className="container mx-auto flex px-5 py-24 items-center justify-center flex-col relative">
<div id="home" className="container opacity-100 mx-auto flex px-5 py-24 items-center justify-center flex-col relative">
<Image
className="w-220 h-220 absolute top-1300 z-10"
src={home}
Expand Down Expand Up @@ -52,9 +87,16 @@ const Homepage = () => {
height={800}
alt="Picture of the author"
/>
<div className="flex w-full md:justify-start justify-center mx-1 items-end">
<button className="transition ease-in-out delay-150 bg-blue-500 hover:-translate-y-1 hover:scale-110 hover:bg-indigo-500 duration-300 inline-flex text-white bg-indigo-500 border-1 py-2 px-6 focus:outline-none hover:bg-indigo-600 rounded text-lg">
<Link href="/aboutUs">Explore</Link>
<div className="flex w-full md:justify-start justify-center mx-1 my-4 items-end">
<button className="transition ease-in-out delay-150 bg-[#8DD5FF] hover:-translate-y-1 hover:scale-110 hover:bg-[#8DD5FF] duration-300 inline-flex text-white bg-bg-[#8DD5FF] border-1 py-3 px-6 focus:outline-none hover:bg-bg-[#8DD5FF] rounded text-lg">
<Link href="/aboutUs">
<Image
src={Explore}
width={70}
height={70}
alt="Picture of the author"
/>
</Link>
</button>
</div>
<div className="flex lg:flex-row md:flex-col text-gray-300"></div>
Expand Down Expand Up @@ -87,9 +129,33 @@ const Homepage = () => {
<div className="flex text-gray-300"></div>
</div>
</div>
<div className="container mx-auto flex flex-col px-5 py-24 justify-center items-center">
<div className="w-full md:w-3/4 flex flex-col mb-16 items-center text-center">
<Image
src={text4}
width={1800}
height={500}
alt="Picture of the author"
/>
<div className="flex text-gray-300"></div>
</div>
</div>
<div className="container flex flex-col px-5 py-24 relative">
<div className="absolute right-0 flex flex-col mb-16">
<Link href={'./events'}>
<Image
src={Footer}
width={600}
height={500}
alt="Picture of the author"
/>
</Link>
</div>
</div>
<div className="container px-5 py-24 my-50 mx-auto">
<div className="w-full flex flex-col mb-16 items-center text-center0">
<div className="w-full flex flex-col mb-16">
<Image
className=" mx-10"
src={Sponsors}
width={400}
height={600}
Expand All @@ -102,7 +168,7 @@ const Homepage = () => {
</div>
<div class="flex flex-wrap sm:-m-4 -mx-4 -mb-10 -mt-4">
<div class="p-4 md:w-1/4 sm:mb-0 mb-6">
<div class="rounded-lg h-84 overflow-hidden">
<div class="rounded-lg overflow-hidden">
<Image
src={irc}
width={600}
Expand All @@ -112,7 +178,7 @@ const Homepage = () => {
</div>
</div>
<div class="p-4 md:w-1/4 sm:mb-0 mb-6">
<div class="rounded-lg h-84 overflow-hidden">
<div class="rounded-lg overflow-hidden">
<Image
src={ASL}
width={600}
Expand All @@ -122,7 +188,7 @@ const Homepage = () => {
</div>
</div>
<div class="p-4 md:w-1/4 sm:mb-0 mb-6">
<div class="rounded-lg h-84 overflow-hidden">
<div class="rounded-lg overflow-hidden">
<Image
src={lovin}
width={600}
Expand All @@ -132,7 +198,7 @@ const Homepage = () => {
</div>
</div>
<div class="p-4 md:w-1/4 sm:mb-0 mb-6">
<div class="rounded-lg h-84 overflow-hidden">
<div class="rounded-lg overflow-hidden">
<Image
src={ari}
width={600}
Expand Down
31 changes: 0 additions & 31 deletions src/app/components/Navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,7 @@ import { useEffect } from "react";
import Image from "next/image";

const Navbar = () => {
// document.addEventListener("DOMContentLoaded", function () {
// function updateUI() {
// var authButton = document.getElementById("authButton");
// var isLoggedIn = Cookies.get('User')

// if (!isLoggedIn) {
// authButton.setAttribute('value', 'Login');

// } else {
// authButton.setAttribute('value', 'Logout');
// }
// }
// document
// .getElementById("authButton")
// .addEventListener("click", function () {
// var user = Cookies.get('User');

// if (user) {
// Cookies.remove('User')
// console.log("calledif")
// } else {
// console.log("calledelse")
// // Cookie.set('User', "true", 7);
// }
// updateUI();
// });
// updateUI();
// });
useEffect(() => {
// Ensure code only runs on the client-side
if (typeof document !== 'undefined' && typeof Cookies !== 'undefined') {
function updateUI() {
var authButton = document.getElementById("authButton");
Expand All @@ -47,8 +18,6 @@ const Navbar = () => {
authButton.innerText = "Logout";
}
}

// Run updateUI function when the DOM content is loaded
updateUI();

}
Expand Down
Binary file added src/app/image/Explore.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 src/app/image/footer.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 src/app/image/text4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.