Skip to content

Commit 4bdfffe

Browse files
committed
fix(ui): 🐛 themes now properly display system color text
1 parent 1145602 commit 4bdfffe

8 files changed

Lines changed: 56 additions & 34 deletions

File tree

public/logo-dl.webp

58.1 KB
Loading

public/logo-pp.webp

44.7 KB
Loading

src/app/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default function NotFound() {
1616
<div className="flex flex-col flex-grow w-full items-center justify-center">
1717
<div className="flex flex-col gap-12 items-center">
1818
<h1 className="text-5xl font-bold">
19-
<span className="text-muted-foreground">404 &mdash;</span> Not Found
19+
<span className="text-foreground/60">404 &mdash;</span> Not Found
2020
</h1>
2121
<StatLink href="/">
2222
<Button variant="outline">

src/app/page.tsx

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,40 @@
33
import { useTheme } from "next-themes";
44
import FooterButton from "../components/ui/footer-button";
55
import HomeSection from "../components/ui/home-section";
6-
import ProjectButton from "../components/ui/project-button";
6+
import ProjectButton, {ProjectButtonProps} from "../components/ui/project-button";
77
import { StatLink } from "@/components/ui/stat-link";
88
import { cn } from "@/utils/utils";
99
import { useEffect, useState } from "react";
1010

11+
12+
const HOMEPAGE_PROJECTS: ProjectButtonProps[] = [
13+
{
14+
imgSrc: "/logo-pp.webp",
15+
href: "https://peterplate.com",
16+
title: "PeterPlate",
17+
shortDesc: "Discover dining options and plan meals at UC Irvine.",
18+
tags: ["Tool", "Web", "UCI"],
19+
},
20+
{
21+
imgSrc: "/logo-dl.webp",
22+
href: "https://deadlock.jacobmoy.com",
23+
title: "Deadlock Tier List",
24+
shortDesc: "Vote on the viability of your favorite characters from Deadlock.",
25+
tags: ["Game", "Tool"],
26+
},
27+
{
28+
imgSrc: "/exsanguination.webp",
29+
href: "https://github.com/EightBitByte/exsanguination",
30+
title: "Exsanguination",
31+
shortDesc: "Defend against the encroaching virus and infected hordes.",
32+
tags: ["Game", "WIP"],
33+
},
34+
];
35+
1136
export default function Home() {
12-
const { theme } = useTheme();
37+
const { resolvedTheme } = useTheme();
1338
const [isMounted, setIsMounted] = useState(false);
39+
const usingLight: boolean = resolvedTheme == "light" || resolvedTheme == "latte"
1440

1541
useEffect(() => {
1642
setIsMounted(true);
@@ -29,7 +55,7 @@ export default function Home() {
2955
</h1>
3056
<div className={cn(
3157
"flex flex-col gap-5 text-lg md:text-xl tracking-wideish leading-[22px] md:leading-7",
32-
theme != "light" && theme != "latte" && "text-foreground/60",
58+
!usingLight && "text-foreground/60",
3359
)}>
3460
<p>
3561
My journey with computers began at the age of five when I haphazardly
@@ -48,32 +74,17 @@ export default function Home() {
4874
</div>
4975
</HomeSection>
5076
<HomeSection title="Projects" gap={6}>
51-
<ProjectButton
52-
imgSrc="/logo-zm.webp"
53-
href="https://github.com/icssc/PeterPlate"
54-
title="PeterPlate"
55-
shortDesc="Discover dining options and plan meals at UC Irvine."
56-
tags="Tool,Web,UCI"
57-
/>
58-
<ProjectButton
59-
imgSrc="/logo-lc.webp"
60-
href="https://github.com/EightBitByte/leetcode-watcher"
61-
title="LeetCode Watcher"
62-
shortDesc="Monitor friends' progress and get live updates without leaving Discord."
63-
tags="Bot,Discord"
64-
/>
65-
<ProjectButton
66-
imgSrc="/exsanguination.webp"
67-
href="https://github.com/EightBitByte/exsanguination"
68-
title="Exsanguination"
69-
shortDesc="Defend against the encroaching virus and infected hordes."
70-
tags="Game,WIP"
71-
/>
77+
{HOMEPAGE_PROJECTS.map(props =>
78+
<ProjectButton
79+
key={props.title}
80+
{...props}
81+
/>
82+
)}
7283
</HomeSection>
7384
<HomeSection title="Contact" gap={4}>
7485
<div className={cn(
7586
"text-lg md:text-xl tracking-wideish leading-[22px] md:leading-7 flex flex-col gap-5",
76-
theme != "latte" && theme != "light" && "text-foreground/60"
87+
!usingLight && "text-foreground/60",
7788
)}>
7889
<p>
7990
<StatLink

src/components/toaster-provider.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@ export function ToasterProvider() {
1212
setMounted(true);
1313
}, []);
1414

15+
if (!mounted) {
16+
return null;
17+
}
18+
1519
const sonnerTheme = theme === 'system' ? (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light') : theme;
1620

1721
return (
18-
<Toaster theme={sonnerTheme as "light" | "dark" | "system"} richColors closeButton/>
22+
<Toaster theme={sonnerTheme as "light" | "dark" | "system"} richColors closeButton />
1923
);
2024
}

src/components/ui/home-section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function HomeSection({
1717
}: HomeSectionProps) {
1818
return (
1919
<div
20-
className={`grid grid-cols-[9fr_100fr] grid-rows-1 px-4 max-w-full
20+
className={`grid grid-cols-[9fr_100fr] grid-rows-1 px-4 min-w-full max-w-full
2121
md:px-0 lg:w-1/2 ${className}`}
2222
>
2323
<p

src/components/ui/project-button.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export interface ProjectButtonProps {
1313
title: string;
1414
/* A short (<80 char) description of the project */
1515
shortDesc: string;
16-
/* Comma delineated tags */
17-
tags: string;
16+
/* Project organizational tags */
17+
tags: string[];
1818
}
1919

2020
export default function ProjectButton({
@@ -24,7 +24,10 @@ export default function ProjectButton({
2424
shortDesc,
2525
tags,
2626
}: ProjectButtonProps) {
27-
const { theme } = useTheme();
27+
const { resolvedTheme } = useTheme();
28+
const usingLight: boolean = resolvedTheme == "light" || resolvedTheme == "latte"
29+
30+
console.log(resolvedTheme == "light")
2831

2932
return (
3033
<a
@@ -43,20 +46,20 @@ export default function ProjectButton({
4346
fill
4447
className={cn(
4548
"rounded-full",
46-
theme != "light" && theme != "latte" && "brightness-65"
49+
(!usingLight && "brightness-65")
4750
)}
4851
/>
4952
</div>
5053
<div>
5154
<h1 className={cn(
5255
"md:text-xl",
53-
theme != "light" && theme != "latte" && "text-foreground/60"
56+
!usingLight && "text-foreground/60"
5457
)}>
5558
<span className="font-bold text-[var(--foreground)]">{title}</span> -{" "}
5659
{shortDesc}
5760
</h1>
5861
<div className="flex flex-row gap-2">
59-
{tags.split(",").map((tag) => (
62+
{tags.map((tag) => (
6063
<p
6164
key={tag}
6265
className="rounded-full border-1 border-[var(--divider)]

src/store/game-store.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ export const SHOP_DATA = {
192192
},
193193
} as const;
194194

195+
export const LIGHT_THEMES = new Set(["light", "latte"]);
196+
197+
export const DARK_THEMES = new Set(["dark", "mocha", "habamax"]);
198+
195199
export type ShopId = keyof typeof SHOP_DATA;
196200

197201
// --- STORE TYPES ---

0 commit comments

Comments
 (0)