Skip to content

Commit 4651470

Browse files
committed
Blurred header, darker challenges, etc.
1 parent 041e263 commit 4651470

File tree

7 files changed

+32
-7
lines changed

7 files changed

+32
-7
lines changed

app/(home)/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Timer from '@/app/(home)/Timer';
33

44
export default function Home() {
55
return (
6-
<main className="container py-24 flex flex-col items-center">
6+
<main className="container pt-36 pb-24 flex flex-col items-center">
77
<img src="/assets/logo.svg" />
88
<Timer />
99
todo

app/NavBar.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
'use client'
2+
3+
import {useScroll} from '@/hooks/useScroll';
14
import NavLink from '@/app/NavLink';
25

36

47
export default function NavBar() {
8+
const scroll = useScroll();
9+
510
return (
6-
<nav className="flex justify-center pt-2">
11+
<nav className={'flex justify-center pt-3 pb-2 fixed w-full top-0 transition duration-200' + (scroll > 0 ? ' bg-black/30 backdrop-blur-md' : '')}>
712
<NavLink href="/">Home</NavLink>
813
<NavLink href="/scoreboard">Scoreboard</NavLink>
914
<NavLink href="/challenges">Challenges</NavLink>

app/challenges/Challenge.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export default function Challenge() {
22
return (
3-
<div className="bg-black/30 px-6 py-4 rounded">
3+
<div className="bg-black/50 px-6 py-4 rounded">
44
<div className="flex justify-between">
55
<h3 className="font-semibold">
66
web/foo

app/challenges/Challenges.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import Challenge from '@/app/challenges/Challenge';
33

44
export default function Challenges() {
55
return (
6-
<div className="flex-grow flex flex-col gap-2">
6+
<div className="flex-grow flex flex-col gap-3">
7+
<Challenge />
8+
<Challenge />
79
<Challenge />
810
<Challenge />
911
<Challenge />

app/challenges/Filters.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@ import type {ReactNode} from 'react';
22

33
export default function Filters() {
44
return (
5-
<div className="bg-black/20 px-6 py-4 rounded w-80 h-max">
5+
<div className="bg-black/30 px-6 py-4 rounded w-80 h-max sticky top-32">
66
<h2 className="font-semibold mb-1">Filters</h2>
77

8-
<div className="flex flex-col gap-1 pl-2">
8+
<div className="flex flex-col gap-1 pl-2 mb-3">
99
<FilterOption>crypto</FilterOption>
1010
<FilterOption>misc</FilterOption>
1111
<FilterOption>pwn</FilterOption>
1212
<FilterOption>rev</FilterOption>
1313
<FilterOption>web</FilterOption>
1414
</div>
15+
<div className="pl-2">
16+
<FilterOption>Show solved</FilterOption>
17+
</div>
1518
</div>
1619
)
1720
}

app/challenges/page.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Challenges from '@/app/challenges/Challenges';
44

55
export default function ChallengesPage() {
66
return (
7-
<div className="container py-24 flex gap-4">
7+
<div className="container pt-32 pb-24 flex gap-4">
88
<Filters />
99
<Challenges />
1010
</div>

hooks/useScroll.ts

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import {useEffect, useState} from 'react';
2+
3+
4+
// Returns the current vertical scroll of the window, in pixels.
5+
export function useScroll() {
6+
const [scroll, setScroll] = useState(0);
7+
8+
useEffect(() => {
9+
setScroll(window.scrollY);
10+
document.addEventListener('scroll', () => setScroll(window.scrollY));
11+
return () => document.removeEventListener('scroll', () => setScroll(window.scrollY));
12+
}, []);
13+
14+
return scroll;
15+
}

0 commit comments

Comments
 (0)