Skip to content

Add books section with 3D shelf visualization - #163

Open
injoon5 wants to merge 2 commits into
mainfrom
claude/read-books-section-design-ug42e0
Open

Add books section with 3D shelf visualization#163
injoon5 wants to merge 2 commits into
mainfrom
claude/read-books-section-design-ug42e0

Conversation

@injoon5

@injoon5 injoon5 commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Adds a complete books feature to the site, including a reading shelf with 3D book pile visualization, individual book pages with bilingual support, and integration into the home page.

Key Changes

  • Book shelf components (BookVolume.svelte, BookPile.svelte, BookPiles.svelte): 3D rendered book spines with cloth textures, realistic shadows, and hover interactions that slide books out of the pile
  • Book detail pages ([slug]/+page.svelte): Full book pages with cover art, ratings, reading status, bilingual content switching (English/Korean), and comment sections
  • Book styling system (bookStyle.js): Deterministic cloth color assignment from book slugs, spine thickness calculation from page count, and a palette of 12 muted binding colors
  • Content structure: Markdown-based books in routes/books/books/{en,ko}/ with frontmatter for metadata (title, author, rating, pages, color, reading status)
  • API endpoints: /api/books for fetching book metadata, /books listing page, and individual book routes
  • Home page integration: Books shelf displayed on the home page with a link to the full /books listing
  • OG card templates: Added booksListTemplate and bookTemplate for social media previews
  • Navigation: Added "books" link to the navbar

Implementation Details

  • Book geometry and cloth colors are derived deterministically from slugs using FNV-1a hashing, ensuring consistent rendering across server and client without hydration mismatches
  • The 3D book visualization uses CSS transforms, perspective, and gradients to create realistic cloth weave, light rolls, joint grooves, and shadows—no canvas or WebGL
  • Bilingual book pages support language switching with smooth transitions (blur/fly animations) and persist language preference to localStorage and cookies
  • Books are laid out bottom-up in the DOM so upper books paint over lower ones, creating proper shadow layering
  • The shelf uses container queries (cqw) for responsive scaling without breakpoints
  • Ratings use a 0–5 scale with half-step support, rendered as five star marks

https://claude.ai/code/session_01Jfaf9KteuRVWSi1iA3VPA7

Books work exactly like blog posts and projects: one markdown file per
book in books/books/{en,ko}, same bilingual resolution, same comments and
likes, same prerendered metadata API. Dropping a file in is the whole
workflow. Frontmatter adds author, rating, page count, binding cloth,
cover/spine artwork and a `reading` flag; the folder README documents it.

The section renders each book as an object rather than a card. A pile is
solved as a sequence, not per book, because that is what a pile is: every
book lies flat, since a book on a flat book is flat, and the only freedom
it has is how far it is turned about the vertical. The pile's perspective
turns that turn into what you actually see — the near end of a spine
taller, the far end shorter and riding up. Sizing is in container query
units, so a pile is one object that scales from a phone to a wide column
with no breakpoints, and the geometry comes off the slug hash so the
server and the client always agree.

Home gets two piles of the six most recent; /books gets the full pile
above the list, one pile on a phone and two on a wide screen. Reaching for
a book slides it out sideways and opens the pile around it, all from
sibling selectors. A book's own page shows it turned to face you, with the
same cloth, foil and grooves on its spine.

Also: /books/* joins the SSR language resolver, so Korean book pages are
no longer served declared as English, and books get their own OG cards
instead of borrowing the blog's.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfaf9KteuRVWSi1iA3VPA7
@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
web Ready Ready Preview, Comment Jul 27, 2026 4:19pm

Probing the hover in a browser turned up two things. The top board of the
top book is a 430x50 surface that looks like part of the book, but it is
painted outside the anchor's own box and had pointer events off, so it was
dead to the cursor — it is now part of the target. And the hover scale
grew from the centre, so a book coming out of a pile crept leftwards by
half the growth before moving right; the translate now pays that back, so
the left edge holds still and the whole thing reads as one movement,
outwards. That also stops a hover started near the left edge from dropping
on the next twitch of the mouse: the edge used to slide 16px out from
under the cursor, now 6.

The pile opens further around the book you are reaching for, and the pull
and the lift are in container units like everything else, so the gesture
is the same size on a phone as on a desktop.

On a book's own page the hero is bigger and grows with the viewport, its
cover type scales with it and clamps instead of spilling, it is centred
against the block of text beside it, and it lines up with the prose below.
That last one needs the negative margin: the book is turned, so it paints
its left edge inside its layout box, and aligning the box would have left
it visibly indented.

Verified with a browser: keyboard focus drives the same choreography, a
tap on touch navigates without animating, and reduced motion holds the
book still.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jfaf9KteuRVWSi1iA3VPA7
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 27, 2026

Copy link
Copy Markdown

Deploying web with  Cloudflare Pages  Cloudflare Pages

Latest commit: 361c8fa
Status:🚫  Build failed.

View logs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants