Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ lib/
className={cn("base-classes", conditional && "extra-classes", className)}
```
- **Responsive**: Mobile-first with `sm:`, `md:`, `lg:` prefixes
- **Dark mode**: Always active (`.dark` class on body)
- **Early-web theme**: white page, Times New Roman (`font-serif`), classic blue/purple underlined links (set
globally in `globals.css`), thin `#a2a9b1` rules and boxes. Every page renders inside `<RetroPage>`
(`components/retro-page.tsx`), which adds the link bar, footer, and the animated ASCII background
(`components/ascii-background.tsx`). Use `<RetroTitle>` for page titles.

### Animation Patterns

Expand Down Expand Up @@ -125,12 +128,10 @@ export function Projects() {
## Common Gotchas

1. **Client components**: Components using `motion`, hooks, or event handlers need `"use client"`
2. **Font loading**: Geist Sans and Geist Pixel Square are subset into `lib/fonts/` by `scripts/subset-fonts.py`
(run by hand with `uv run`, output committed) and applied as CSS variables on `<html>` via `fontVariables`.
Don't edit `lib/fonts/index.ts`; rerun the script after content adds new characters (`--check` tells you),
after upgrading `geist`, or when using a new weight, italic face, OpenType feature, or Pixel variant.
2. **Fonts**: none are loaded; the site uses system Times New Roman / Courier New on purpose.
3. **Anchor navigation**: Section IDs use lowercase (`id={title.toLowerCase()}`)
4. **Dark mode only**: Site is permanently in dark mode
4. **Home page**: name, then the full post list (`components/post-index.tsx`). No about or projects
sections; that data in `lib/site-content.ts` still feeds the Markdown mirrors (`lib/markdown-pages.ts`).
5. **No API routes**: Static portfolio site

---
Expand Down
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,26 @@ All notable changes to this project are documented here. The format is based on

## [Unreleased]

### Changed

- **Early-web redesign**: every page is a plain white document in Times New
Roman with classic blue/purple underlined links, a `[ GitHub | Twitter ]`
link bar, encyclopedia-style titles, text straight on the page (no card), a
numbered "Contents" box and a "Categories" box on posts, and light code
blocks. Behind it runs an animated, dithered ASCII noise background (black on
white, frozen for reduced motion) that fades almost out behind the text
column. (`components/retro-page.tsx`, `components/ascii-background.tsx`)
- **Home page goes straight to the posts**: the intro paragraph, skills, about,
and projects sections are gone; the page is the name and the full post
list. The link bar only has GitHub and Twitter.

### Removed

- The dithering shader backgrounds, the green hover-band blog lists, and the
scroll-spy table-of-contents sidebar.
- Geist fonts and `scripts/subset-fonts.py` (no web fonts are loaded now), and
the unused dark card components.

### Added

- **Markdown page mirrors**: public pages now expose `text/markdown` versions
Expand Down
107 changes: 44 additions & 63 deletions app/(frontend)/blog/[slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "highlight.js/styles/github-dark.css";
import "highlight.js/styles/github.css";
import hljs from "highlight.js";
import Link from "next/link";
import { ArcadeChevronLeft, ArcadeUTurnLeft } from "@/components/icons/arcade-icons";
import Image from "next/image";
import { notFound } from "next/navigation";
import type { Metadata } from "next";
Expand All @@ -11,7 +10,8 @@ import { RichText } from "@payloadcms/richtext-lexical/react";
import type { JSXConvertersFunction } from "@payloadcms/richtext-lexical/react";
import type { Media as MediaType, Tag } from "@/payload-types";
import { extractHeadings } from "@/lib/blog-toc";
import { TocSidebar } from "@/components/blog/toc-sidebar";
import { ContentsBox } from "@/components/contents-box";
import { RetroPage, RetroTitle } from "@/components/retro-page";

export const dynamic = "force-dynamic";

Expand Down Expand Up @@ -88,7 +88,7 @@ export default async function BlogPostPage({ params }: Props) {
? hljs.highlight(code, { language, ignoreIllegals: true }).value
: hljs.highlightAuto(code).value;
return (
<pre className="hljs overflow-x-auto rounded-lg border border-neutral-800 !bg-neutral-950 p-4 text-[13px] leading-relaxed">
<pre className="hljs overflow-x-auto border border-[#eaecf0] !bg-[#f8f9fa] p-3 text-[13px] leading-relaxed">
<code dangerouslySetInnerHTML={{ __html: highlighted }} />
</pre>
);
Expand All @@ -97,82 +97,63 @@ export default async function BlogPostPage({ params }: Props) {
};
};

return (
<main className="max-w-xl mx-auto px-6 py-16">
<TocSidebar headings={headings} />

{/* On xl+ the "see all" link lives at the top of the TOC sidebar. */}
<div className="mb-12 xl:hidden">
<Link
href="/blog"
className="inline-flex items-center gap-[0.3em] text-xs tracking-wide text-neutral-500 hover:text-neutral-200 transition-colors duration-300"
>
<ArcadeUTurnLeft />
<span className="font-pixel">see all</span>
</Link>
</div>
const published = new Date(post.publishedAt).toLocaleDateString("en-GB", {
year: "numeric",
month: "long",
day: "numeric",
});

return (
<RetroPage>
<article>
<header className="mb-10">
<h1 className="text-2xl font-medium tracking-tight font-pixel">{post.title}</h1>

<div className="flex flex-wrap gap-3 text-xs text-neutral-500 mt-3">
<RetroTitle
subtitle={
<span suppressHydrationWarning>
{new Date(post.publishedAt).toLocaleDateString("en-US", {
year: "numeric",
month: "long",
day: "numeric",
})}
{published}
{post.readTime && (
<> &middot; {/^\d+$/.test(post.readTime) ? `${post.readTime} min read` : post.readTime}</>
)}
</span>
{post.readTime && (
<>
<span>&#183;</span>
<span>{post.readTime}</span>
</>
)}
</div>

{tags.length > 0 && (
<div className="flex flex-wrap gap-2 mt-4">
{tags.map((tag) => (
<span
key={tag.id}
className="text-xs text-neutral-400 bg-neutral-800/50 px-2.5 py-1 rounded-full"
>
{tag.name}
</span>
))}
</div>
)}
</header>
}
>
{post.title}
</RetroTitle>

{heroImage?.url && (
<div className="mb-10 rounded-lg overflow-hidden">
<figure className="mb-5 border border-[#c8ccd1] bg-[#f8f9fa] p-1">
<Image
src={heroImage.url}
alt={heroImage.alt}
width={1200}
height={630}
className="w-full"
className="w-full border border-[#c8ccd1]"
/>
</div>
</figure>
)}

<div className="prose prose-invert prose-sm max-w-none prose-headings:font-medium prose-headings:text-white prose-headings:tracking-tight prose-p:text-neutral-300 prose-p:leading-relaxed prose-a:text-white prose-a:underline prose-a:underline-offset-2 prose-code:text-neutral-300 prose-pre:bg-neutral-900 prose-pre:border prose-pre:border-neutral-800 prose-pre:rounded-lg prose-strong:text-white prose-blockquote:border-neutral-700 prose-blockquote:text-neutral-400">
<ContentsBox headings={headings} />

<div className="prose max-w-none font-serif text-[17px] text-black prose-headings:font-serif prose-headings:font-normal prose-headings:text-black prose-h2:border-b prose-h2:border-[#a2a9b1] prose-h2:pb-1 prose-h2:text-[1.6rem] prose-h3:text-[1.25rem] prose-h3:font-bold prose-a:font-normal prose-a:text-[#0000ee] [&_a:visited]:text-[#551a8b] prose-strong:text-black prose-blockquote:border-[#a2a9b1] prose-blockquote:font-normal prose-blockquote:not-italic prose-blockquote:text-[#202122] prose-code:font-normal prose-code:before:content-none prose-code:after:content-none [&_:not(pre)>code]:border [&_:not(pre)>code]:border-[#eaecf0] [&_:not(pre)>code]:bg-[#f8f9fa] [&_:not(pre)>code]:px-1 [&_:not(pre)>code]:text-[0.85em]">
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any */}
<RichText data={post.content as any} converters={jsxConverters} />
</div>
</article>

<div className="border-t border-neutral-800 mt-16 pt-6">
<Link
href="/blog"
className="inline-flex items-center gap-[0.3em] text-neutral-500 text-sm hover:text-white transition-colors duration-300"
>
<ArcadeChevronLeft />
<span className="font-pixel">Back to all posts</span>
</Link>
</div>
</main>
{tags.length > 0 && (
<div className="mt-10 border border-[#a2a9b1] bg-[#f8f9fa] px-3 py-2 text-sm">
Categories:{" "}
{tags.map((tag, i) => (
<span key={tag.id}>
{i > 0 && " | "}
{tag.name}
</span>
))}
</div>
)}

<p className="mt-6 text-sm">
&larr; <Link href="/blog">Back to all posts</Link>
</p>
</article>
</RetroPage>
);
}
68 changes: 9 additions & 59 deletions app/(frontend)/blog/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import Link from "next/link";
import { ArcadeChevronLeft } from "@/components/icons/arcade-icons";
import type { Metadata } from "next";
import { getPayload } from "payload";
import config from "@payload-config";
import { BlogList, type BlogListItem } from "@/components/blog-list";

export const dynamic = "force-dynamic";

import type { Metadata } from "next";
import { PostIndex } from "@/components/post-index";
import { RetroPage, RetroTitle } from "@/components/retro-page";

export const metadata: Metadata = {
title: "Blog | Khushal Bhardwaj",
description: "Blog posts by Khushal Bhardwaj",
Expand All @@ -17,58 +14,11 @@ export const metadata: Metadata = {
},
};

export default async function BlogPage() {
const payload = await getPayload({ config });
const { docs: posts } = await payload.find({
collection: "posts",
sort: "-publishedAt",
limit: 50,
depth: 1,
});

const items: BlogListItem[] = posts.map((post) => {
const hero =
post.heroImage && typeof post.heroImage === "object"
? post.heroImage
: null;
const heroUrl = hero?.sizes?.card?.url ?? hero?.url ?? null;
return {
id: post.id,
title: post.title,
slug: post.slug,
excerpt: post.excerpt,
publishedAt: post.publishedAt,
readTime: post.readTime,
heroImage: heroUrl
? {
url: heroUrl,
alt: hero?.alt ?? post.title,
width: hero?.sizes?.card?.width ?? hero?.width,
height: hero?.sizes?.card?.height ?? hero?.height,
}
: null,
};
});

export default function BlogPage() {
return (
<main className="max-w-5xl mx-auto px-6 py-16">
<div className="mb-12">
<Link
href="/"
className="inline-flex items-center gap-[0.3em] text-neutral-500 text-sm hover:text-white transition-colors duration-300"
>
<ArcadeChevronLeft />
<span className="font-pixel">Back</span>
</Link>
</div>

<h1 className="text-2xl font-medium tracking-tight mb-10 font-pixel">Blog</h1>

{items.length === 0 ? (
<p className="text-neutral-500 text-sm">No posts yet.</p>
) : (
<BlogList posts={items} />
)}
</main>
<RetroPage>
<RetroTitle subtitle="Everything written here, newest first.">All posts</RetroTitle>
<PostIndex />
</RetroPage>
);
}
30 changes: 13 additions & 17 deletions app/(frontend)/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,34 @@

@layer base {
* {
@apply border-neutral-800;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}

body {
@apply bg-black text-white antialiased;
font-family: var(--font-geist-sans), system-ui, sans-serif;
text-transform: lowercase;
@apply bg-white font-serif text-[17px] leading-relaxed text-[#202122];
}

::-webkit-scrollbar {
width: 6px;
height: 6px;
/* Classic browser link colors. */
a {
color: #0000ee;
text-decoration: underline;
text-underline-offset: 2px;
}

::-webkit-scrollbar-track {
@apply bg-black;
a:visited {
color: #551a8b;
}

::-webkit-scrollbar-thumb {
@apply bg-neutral-700 rounded-full;
a:hover {
text-decoration-thickness: 2px;
}

::-webkit-scrollbar-thumb:hover {
@apply bg-neutral-600;
a:active {
color: #ee0000;
}

::selection {
@apply bg-white/20 text-white;
@apply bg-[#0000ee] text-white;
}
}

Expand Down
9 changes: 4 additions & 5 deletions app/(frontend)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import type { Metadata, Viewport } from "next";
import Script from "next/script";
import { Analytics } from "@vercel/analytics/next";
import { SpeedInsights } from "@vercel/speed-insights/next";
import { fontVariables } from "@/lib/fonts";
import { SITE_URL } from "@/lib/site-content";

export const metadata: Metadata = {
Expand All @@ -18,8 +17,8 @@ export const metadata: Metadata = {

export const viewport: Viewport = {
themeColor: [
{ media: "(prefers-color-scheme: light)", color: "#000000" },
{ media: "(prefers-color-scheme: dark)", color: "#000000" },
{ media: "(prefers-color-scheme: light)", color: "#ffffff" },
{ media: "(prefers-color-scheme: dark)", color: "#ffffff" },
],
};

Expand All @@ -29,8 +28,8 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
<html lang="en" style={fontVariables}>
<body className="scroll-smooth min-h-screen bg-gray-950">
<html lang="en">
<body className="scroll-smooth min-h-screen">
{children}
<Analytics />
<SpeedInsights />
Expand Down
20 changes: 8 additions & 12 deletions app/(frontend)/not-found.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
import Link from "next/link";
import { RetroPage, RetroTitle } from "@/components/retro-page";

export default function NotFound() {
return (
<main className="flex min-h-screen items-center justify-center bg-gray-950 text-white">
<div className="text-center">
<h1 className="text-5xl font-medium tracking-tight mb-4">404</h1>
<p className="text-neutral-400 text-sm mb-8">This page doesn&apos;t exist.</p>
<Link
href="/"
className="inline-flex items-center px-5 py-2 bg-white text-black text-sm font-medium rounded-full hover:bg-neutral-200 transition-colors duration-300"
>
Go home
</Link>
</div>
</main>
<RetroPage>
<RetroTitle subtitle="Error 404">Page not found</RetroTitle>
<p>
There is currently no page at this address. Try the <Link href="/">home page</Link> or the{" "}
<Link href="/blog">list of all posts</Link>.
</p>
</RetroPage>
);
}
Loading