This is a lightweight, responsive digital bookshelf application built with React. It allows users to browse PDF books stored on a server and read them instantly through an integrated reader component.
- Dynamic Book Loading: Automatically fetches the book list and metadata from
public/pdfs/books.json. - Responsive Grid Layout: Powered by Tailwind CSS, providing a fluid layout optimized for everything from mobile devices to ultra-wide screens.
- Dark Mode Support: Includes a theme toggle that persists user preferences in
localStorage. - Full-screen Reading Experience: Clicking a book opens a full-screen overlay via the
BookReadercomponent. - Deployment Flexibility: Utilizes Vite's
BASE_URLconfiguration to ensure assets are fetched correctly regardless of the deployment subpath.
- Framework: React (TypeScript).
- Styling: Tailwind CSS.
- Icons: Lucide React.
- State Management: React Hooks (
useState,useEffect). - Environment: Vite (for
BASE_URLhandling).
To add books to your shelf, please follow these steps:
Place your PDF files into the public/pdfs/ directory.
Edit the public/pdfs/books.json file. The structure should follow this format:
[
{
"id": "1",
"title": "Example Book Title",
"author": "Author Name",
"coverUrl": "URL to cover image",
"url": "pdf-filename.pdf"
}
]Note: The application automatically applies encodeURI to the url property to ensure filenames with special characters load correctly.
git clone [your-repo-url] npm install npm run dev-
Header: Contains the library icon and the dark mode toggle button.
-
Main Content:
- Displays a "No books available" prompt if the book list is empty.
- Displays a grid of BookCard components when books are available.
-
Reader Overlay: A full-screen reader interface that appears when a book is selected.