Skip to content

Commit

Permalink
Style/Refactor: Fixed responsiveness on footer and registration / cha…
Browse files Browse the repository at this point in the history
…nged gallery functionality
  • Loading branch information
AntGa committed Feb 9, 2025
1 parent 1fb71a5 commit 0d37653
Show file tree
Hide file tree
Showing 13 changed files with 179 additions and 82 deletions.
4 changes: 2 additions & 2 deletions src/app/(home)/_components/About.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import React from 'react';
import { H1, StatHeading } from '../../../components/layout/Typography';
import { H1, StatHeading } from '@/components/Layout/Typography';
import { AboutUs, EventStats } from '../_data/AboutData';
import { motion } from 'motion/react';

Expand All @@ -17,7 +17,7 @@ const About = () => {
</div>

<motion.div
className="flex flex-row flex-wrap items-center justify-center gap-8 lg:w-1/2"
className="flex flex-row flex-wrap items-center justify-center gap-8 lg:w-[500px]"
initial="hidden"
whileInView="visible"
viewport={{ once: true }}
Expand Down
8 changes: 3 additions & 5 deletions src/app/(home)/_components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ const Hero = () => {
<section
className="responsive-fullwidth relative h-screen w-full bg-cover bg-center"
style={{ backgroundImage: 'url(/images/2024/IMG_2366.JPG)' }}
id="home"
>
<div className="absolute inset-0 z-0 brightness-75 backdrop-blur-sm"></div>
<div className="relative z-10 flex h-full w-full flex-col items-center justify-center">
<div
className="flex w-full flex-col items-center justify-center"
id="home"
>
<div className="flex w-full flex-col items-center justify-center">
<CombinedLogos />
<h1 className="md:7xl text-6xl font-bold lg:text-8xl">HACKATHON</h1>
<p className="text-2xl md:text-3xl">
<p className="text-center text-2xl md:text-3xl">
New Zealand's LARGEST tertiary hackathon
</p>
</div>
Expand Down
19 changes: 7 additions & 12 deletions src/app/(home)/_components/sponsors/Sponsor.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { H1 } from '@/components/layout/Typography';
import { H1 } from '@/components/Layout/Typography';

import { SponsorRow } from './SponsorRow';
import { TechSponsors } from '@/app/(home)/_data/SponsorData';
Expand All @@ -9,19 +9,14 @@ const Sponsors = () => {
<section id="sponsors" className="relative flex flex-col gap-8">
<H1 className="mb-4">Sponsors</H1>
<SponsorRow
title="Gold Sponsors"
titleColor="text-[#FFD700]"
sponsors={TechSponsors.GoldSponsors}
titleColor="text-white"
title="Tech Sponsors"
sponsors={TechSponsors.TechSponsors}
/>
<SponsorRow
title="Silver Sponsors"
titleColor="text-[#C0C0C0]"
sponsors={TechSponsors.SilverSponsors}
/>
<SponsorRow
title="Bronze Sponsors"
titleColor="text-[#CD7F32]"
sponsors={TechSponsors.BronzeSponsors}
titleColor="text-white"
title="Food Sponsors"
sponsors={TechSponsors.FoodSponsors}
/>
</section>
);
Expand Down
4 changes: 2 additions & 2 deletions src/app/(home)/_components/sponsors/SponsorRow.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { H2 } from '@/components/layout/Typography';
import { H2 } from '@/components/Layout/Typography';
import SponsorCard from './SponsorCard';

interface SponsorRowProps {
Expand All @@ -16,7 +16,7 @@ export const SponsorRow = ({
return (
<>
<H2 className={`${titleColor} text-center`}>{title}</H2>
<div className="flex flex-wrap justify-center gap-12">
<div className="flex flex-wrap justify-center gap-12 md:justify-start">
{sponsors.map((sponsor, index) => (
<SponsorCard
color="bg-wdcc-blue"
Expand Down
6 changes: 2 additions & 4 deletions src/app/(home)/_data/SponsorData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const TechSponsors = {
GoldSponsors: [
TechSponsors: [
{
name: 'Atlassian',
src: '/logos/sponsors/atlassian.png',
Expand All @@ -15,8 +15,6 @@ export const TechSponsors = {
src: '/logos/sponsors/sandfield.png',
link: 'https://www.sandfield.co.nz/',
},
],
SilverSponsors: [
{
name: 'Potentia',
src: '/logos/sponsors/potentia.png',
Expand All @@ -33,7 +31,7 @@ export const TechSponsors = {
link: 'https://www.redbull.com/nz-en',
},
],
BronzeSponsors: [
FoodSponsors: [
{
name: 'indomie',
src: '/logos/sponsors/indomie.png',
Expand Down
132 changes: 110 additions & 22 deletions src/app/gallery/page.tsx
Original file line number Diff line number Diff line change
@@ -1,45 +1,133 @@
'use client';
import { H1 } from '@/components/layout/Typography';
import Gallery from '@/app/gallery/_components/Gallery';
import { SectionLayout } from '@/components/layout/SectionLayout';
import FilterButton from '@/components/common/FilterButton';
import { useState } from 'react';
import GalleryImages from './_components/GallaryImages';
import yearImages from '@/data/gallery';
import Lightbox from 'yet-another-react-lightbox';
import 'yet-another-react-lightbox/styles.css';
import 'yet-another-react-lightbox/plugins/counter.css';
import 'yet-another-react-lightbox/plugins/thumbnails.css';
import {
Counter,
Fullscreen,
Thumbnails,
Zoom,
} from 'yet-another-react-lightbox/plugins';
import React from 'react';
import { motion } from 'motion/react';

export default function GalleryPage() {
const [selectedYear, setSelectedYear] = useState<number | null>(null);
const [selectedYears, setSelectedYears] = useState<number[]>([]);
const [lightBoxImageIndex, setLightBoxImageIndex] = useState<number>(-1);
const fullscreenRef = React.useRef(null);

const years = [2024, 2023, 2022, 2021].sort((a, b) => b - a);

const containerVariants = {
hidden: { opacity: 0 },
visible: {
opacity: 1,
transition: {
staggerChildren: 0.1,
},
},
};

const cardVariants = {
hidden: { opacity: 0, y: 50 },
visible: { opacity: 1, y: 0, transition: { duration: 0.5 } },
};

const toggleYear = (year: number) => {
setSelectedYears(
selectedYears.includes(year)
? selectedYears.filter((y) => y !== year)
: [...selectedYears, year]
);
};

// Group images by year
const groupedImages = years.reduce(
(acc, year) => {
const yearFilteredImages = yearImages
.filter(
(image) =>
selectedYears.length === 0 || selectedYears.includes(image.year)
)
.filter((image) => image.year === year)
.map((image) => ({
src: image.image,
alt: image.alt,
year: image.year,
}));

if (yearFilteredImages.length > 0) {
acc[year] = yearFilteredImages;
}
return acc;
},
{} as Record<number, { src: string; alt: string; year: number }[]>
);

// Flatten images for lightbox
const allFilteredImages = Object.values(groupedImages).flat();

return (
<SectionLayout className="flex flex-col">
<H1>Gallery</H1>
<div className="flex flex-col items-center">
<div className="flex gap-4">
{[2024, 2023, 2022, 2021].map((year) => (
<div className="flex flex-wrap justify-center gap-4">
{years.map((year) => (
<FilterButton
key={year}
onClick={() => {
scrollToYearSection(year);
setSelectedYear(year);
}}
isSelected={selectedYear === year}
onClick={() => toggleYear(year)}
isSelected={selectedYears.includes(year)}
>
{year}
</FilterButton>
))}
</div>
</div>
<div className="w-full">
<Gallery year={2024} />
<Gallery year={2023} />
<Gallery year={2022} />
<Gallery year={2021} />
</div>
<motion.div
className="w-full"
key={selectedYears.join('-')}
variants={containerVariants}
initial="hidden"
animate="visible"
>
{years.map((year) => {
const images = groupedImages[year];
if (!images) return null;

return (
<motion.div key={year} className="mb-12" variants={cardVariants}>
<div className="sticky top-16 z-10 flex w-full justify-center backdrop-blur-sm">
<h2 className="mb-4 mt-8 text-3xl font-bold">{year}</h2>
</div>
<GalleryImages
data={images}
onClick={(currentIndex) => {
const startIndex = allFilteredImages.findIndex(
(img) => img.src === images[currentIndex].src
);
setLightBoxImageIndex(startIndex);
}}
/>
</motion.div>
);
})}
<Lightbox
slides={allFilteredImages}
open={lightBoxImageIndex >= 0}
close={() => setLightBoxImageIndex(-1)}
plugins={[Counter, Fullscreen, Zoom, Thumbnails]}
counter={{ container: { style: { top: '0px' } } }}
fullscreen={{ ref: fullscreenRef }}
index={lightBoxImageIndex}
/>
</motion.div>
</SectionLayout>
);
}

function scrollToYearSection(year: number) {
const section = document.getElementById(`year-${year}`);
if (section) {
section.scrollIntoView({ behavior: 'smooth', block: 'start' });
}
}
2 changes: 1 addition & 1 deletion src/app/organisers/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function TeamSection() {
return (
<SectionLayout>
<div className="container mx-auto max-w-screen-sm">
<H1 className="h-min">Organisers</H1>
<H1>Organisers</H1>
<motion.div
className="mt-6 grid grid-cols-1 justify-center gap-6 sm:grid-cols-2 lg:grid-cols-3"
variants={containerVariants}
Expand Down
6 changes: 3 additions & 3 deletions src/app/past-winners/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function PastWinnersPage() {
<SectionLayout>
<header>
<H1>Past Winners</H1>
<div className="mt-8">
<div>
<FilterButtons
years={years}
places={places}
Expand All @@ -55,7 +55,7 @@ export default function PastWinnersPage() {
</div>
</header>

<main className="flex flex-row gap-8">
<main className="flex flex-row">
<div className="flex-1">
{selectedPlace.length > 0 &&
!selectedPlace.includes('Special Awards') ? (
Expand All @@ -64,7 +64,7 @@ export default function PastWinnersPage() {
variants={containerVariants}
initial="hidden"
animate="visible"
className="mt-20 grid grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-3"
className="mt-20 grid grid-cols-1 gap-12 sm:grid-cols-2 lg:grid-cols-3"
>
{allFilteredWinners.map((winner, index) => (
<motion.div
Expand Down
15 changes: 8 additions & 7 deletions src/app/registration/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import React, { useState } from 'react';
import { FORM_URL } from './_data/registrationdata';
import { registrationFaqsInfo } from '@/app/registration/_data/registrationFaqs';
import { H1, H2 } from '@/components/layout/Typography';
import { CountdownTimer } from '@/components/common/CountdownTimer';
Expand All @@ -14,12 +13,14 @@ export default function Registration() {
};

return (
<SectionLayout className="flex flex-col items-center">
<H1 className="mb-8">Registration</H1>
<div className="flex w-full justify-center">
<div className="w-full max-w-6xl px-4 sm:px-6">
<SectionLayout>
<H1 className="">Registration</H1>
<div className="flex w-full">
<div className="w-full">
{/* FOR WHEN REGISTRATIONS ARE CLOSED */}
<H2 className="m-10 text-center text-4xl">COMING SOON...</H2>
<H2 className="text-center text-4xl md:text-center">
COMING SOON...
</H2>
<CountdownTimer />

{/* FOR WHEN REGISTRATIONS ARE OPEN */}
Expand All @@ -41,7 +42,7 @@ export default function Registration() {
key={index}
className={`collapse collapse-arrow ${
openAccordion === index ? 'collapse-open' : 'collapse-close'
} rounded-lg border border-gray-300 bg-white`}
} w-full rounded-lg border border-gray-300 bg-white`}
>
<div
className="collapse-title cursor-pointer text-xl font-medium text-black lg:text-2xl"
Expand Down
30 changes: 18 additions & 12 deletions src/components/Layout/ScrollToTop.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
'use client';

import React from 'react';
import { useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';

function ScrollToTop() {
const [backToTop, setBackToTop] = useState(false);

useEffect(() => {
window.addEventListener('scroll', () => {
if (window.scrollY > 100) {
setBackToTop(true);
} else {
setBackToTop(false);
}
});
const handleScroll = () => {
setBackToTop(window.scrollY > 100);
};

window.addEventListener('scroll', handleScroll);

return () => {
window.removeEventListener('scroll', handleScroll);
};
}, []);

const scrollToTop = () => {
console.log('pog');
window.scrollTo({
top: 0,
behavior: 'smooth',
Expand All @@ -26,12 +28,16 @@ function ScrollToTop() {
return (
<div>
{backToTop && (
<div className="fixed w-10 h-10 bottom-10 right-16">
<div className="fixed bottom-10 right-16 z-50 h-10 w-10">
<button
onClick={scrollToTop}
className="rounded-full w-full h-full bg-white p-2"
className="h-full w-full rounded-full bg-white p-2"
>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill='sesa-navy'>
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 512 512"
fill="sesa-navy"
>
<path d="M233.4 105.4c12.5-12.5 32.8-12.5 45.3 0l192 192c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L256 173.3 86.6 342.6c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3l192-192z" />
</svg>
</button>
Expand Down
Loading

0 comments on commit 0d37653

Please sign in to comment.