Reading Shelf

New

An accordion row of hardcover and paperback spines standing on a rounded shelf ledge. Hover lifts each spine; clicking expands it horizontally into its full cover artwork while neighboring volumes part smoothly.

Interactive Controls

10px
1.00x

Installation

npm install framer-motion
Required Public Assets

Place these sprite sheets and optional audio cues under public/:

  • public/books/*-cover.webp

Props API

PropTypeDefaultDescription
variant"default" | "focus" | "artisan""default"Controls section framing and outer gutter annotation placement.
embeddedbooleanfalseRenders only the interactive shelf rail and ledge without outer section chrome.
hoverLiftnumber10Upward hover lift in pixels on collapsed spines (0–20px).
scalenumber1Multiplier applied to book heights and spine widths.
  • Front covers render real book artwork from /public/books/, while spines are data-driven (and support optional spineImage overrides).
  • Keyboard accessible with Tab, Enter/Space, aria-pressed state, and Escape to collapse the open cover.
  • On screens under 540px, books scale to 0.74x inside a horizontally scrollable rail with overscroll containment.
  • Transitions and hover lift honor prefers-reduced-motion: reduce.

Source Files

"use client";

import React, { useRef, useState } from "react";
import Image from "next/image";
import { motion, useReducedMotion } from "framer-motion";
import { READING_SHELF_BOOKS, type ReadingBookId } from "@/lib/readingShelfData";
import { BookSpine } from "./BookSpine";
import { SectionHeader } from "./SectionHeader";
import { useUISound } from "@/context/SoundContext";
import { sectionContainerVariants, contentBlockVariants } from "@/lib/motion";
import styles from "./ReadingShelf.module.css";

export interface ReadingShelfProps {
  variant?: "default" | "focus" | "artisan";
  embedded?: boolean;
  hoverLift?: number;
  scale?: number;
}

function MarginAnnotation({
  visibilityClass,
  extraClassName = "",
}: {
  visibilityClass: string;
“Good design is as little design as possible.”
Dieter Rams