Skip to content

Commit

Permalink
formatting and style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Bl20052005 committed Nov 2, 2024
1 parent e263d59 commit 34a6f08
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
19 changes: 10 additions & 9 deletions apps/site/src/app/(home)/sections/Countdown/Countdown.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"use client";

import bg_map from "@/assets/images/maps/countdown.svg";
import Image from "next/image";
import useWindow from "./useWindow";
import { useEffect, useState } from "react";

import styles from "./Countdown.module.scss";
import useWindow from "./useWindow";
import CountdownClock from "./CountdownClock";
import { useEffect, useState } from "react";

import boat from "@/assets/icons/boat.png";
import bg_map from "@/assets/images/maps/countdown.svg";
import boat from "@/assets/icons/boat.svg";

import styles from "./Countdown.module.scss";

interface CountdownProps {
schedule: {
Expand Down Expand Up @@ -63,12 +64,12 @@ const Countdown: React.FC<CountdownProps> = ({ schedule }) => {
before.endTime.getTime() > 0
? curTime.getTime() < before.startTime.getTime()
? 0
: ((before.endTime.getTime() - curTime.getTime()) /
: 100 - ((before.endTime.getTime() - curTime.getTime()) /
(before.endTime.getTime() - before.startTime.getTime())) *
100
: 100;

const [w, h] = useWindow();
const [w, ] = useWindow();

const totalLines = Math.floor(w / 66) > 7 ? Math.floor(w / 66) : 7;

Expand All @@ -90,7 +91,7 @@ const Countdown: React.FC<CountdownProps> = ({ schedule }) => {
if (curTime > hackEndTime) {
return (
<div className={styles.countdownWrapper}>
<Image src={bg_map} alt="bg_map" />
<Image src={bg_map} alt="background map for countdown" />
<div className={styles.countdownMaterial}>
<h1 className={styles.endText}>Hacking has ended!</h1>
</div>
Expand All @@ -100,7 +101,7 @@ const Countdown: React.FC<CountdownProps> = ({ schedule }) => {

return (
<div className={styles.countdownWrapper}>
<Image src={bg_map} alt="bg_map" width={2300} />
<Image src={bg_map} alt="background map for countdown" width={2300} />
{w > 0 && (
<div className={styles.countdownMaterial}>
{curTime >= hackStartTime ? (
Expand Down
2 changes: 1 addition & 1 deletion apps/site/src/app/(home)/sections/Countdown/useWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { useEffect, useState } from "react";
export default function useWindow() {
const [size, setSize] = useState([0, 0]);
useEffect(() => {
setSize([window.innerWidth, window.innerHeight]);
function setWindowSize() {
setSize([window.innerWidth, window.innerHeight]);
}
setWindowSize();
window.addEventListener("resize", setWindowSize);
return () => window.removeEventListener("resize", setWindowSize);
}, []);
Expand Down
Binary file removed apps/site/src/assets/icons/boat.png
Binary file not shown.
15 changes: 15 additions & 0 deletions apps/site/src/assets/icons/boat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 34a6f08

Please sign in to comment.