Skip to content

Commit

Permalink
countdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ImNotRog committed Jan 27, 2024
1 parent 9ca61f6 commit 51c7dae
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions src/app/(landing)/Heading.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,40 @@
"use client"
import { Overpass } from '@next/font/google';
import { RiFacebookFill, RiInstagramFill, RiDiscordFill } from 'react-icons/ri';
import { FaEnvelope } from 'react-icons/fa';
import { useEffect, useState } from 'react';

const overpass = Overpass({
subsets: ['latin']
});

const msToTime = (time: number) => {
let ms = time % 1000 + ''; time = Math.floor(time / 1000);
let sec = time % 60 + ''; time = Math.floor(time / 60);
let min = time % 60 + ''; time = Math.floor(time / 60);
let hours = time + '';

if (ms.length < 2) ms = "0" + ms;
if (sec.length < 2) sec = "0" + sec;
if (min.length < 2) min = "0" + min;
if (hours.length < 2) hours = "0" + hours;

return `${hours} : ${min} : ${sec}`;
}

export default function Heading() {

const [ time, setTime ] = useState<null|number>(null);
const END = new Date('2024-01-28T15:00:00').getTime();

useEffect(() => {
setTime(new Date().getTime());
const inv = setInterval(() => {
setTime(new Date().getTime());
}, 100);
return () => clearInterval(inv);
}, []);

return (
<section id="heading" className="text-white text-center h-screen relative flex flex-col items-center justify-center p-5 pb-[20vh]">

Expand Down Expand Up @@ -38,13 +66,12 @@ export default function Heading() {


</div>
<a className={"no-underline"} href="https://docs.google.com/forms/d/e/1FAIpQLSdF_KFH0pH_ryAx3uYglID2ITeXvoTaHfTh2i9YMgnlwLC91A/viewform" rel="noopener noreferrer" target="_blank">
<div className={'mt-10 rounded-lg px-16 py-4 text-2xl bg-white text-[#292834] hover:bg-[#F47722] transition font-bold'}>
Register

<div className={'mt-10 px-16 py-4 text-2xl font-bold'}>
{time ? (time < END ? `The hacking period will end in ${time ? msToTime(END - time) : ''}.` : `The hacking period has ended.`) : '...'}
</div>
</a>

<div className='text-2xl mt-5 flex gap-2 items-center'>
<div className='text-2xl mt-3 flex gap-2 items-center'>
<span className='text-[#F47722] text-5xl'>[</span>
<a href="https://docs.google.com/document/d/1RHcsMJANFuJC4UyZ3ECxpfC0QOi8cvSeZquez7P1Ahg/edit" rel="noopener noreferrer" target="_blank">Hacker Guide</a>
<span className='text-[#F47722] text-5xl'>]</span>
Expand Down

1 comment on commit 51c7dae

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for gunnhacks10 ready!

✅ Preview
https://gunnhacks10-jt66idob3-imnotrog.vercel.app

Built with commit 51c7dae.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.