Reading Shelf
NewAn 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-motionRequired Public Assets
Place these sprite sheets and optional audio cues under public/:
- public/books/*-cover.webp
Props API
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "default" | "focus" | "artisan" | "default" | Controls section framing and outer gutter annotation placement. |
| embedded | boolean | false | Renders only the interactive shelf rail and ledge without outer section chrome. |
| hoverLift | number | 10 | Upward hover lift in pixels on collapsed spines (0–20px). |
| scale | number | 1 | Multiplier 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;