Skip to content

atelesjr/art-explorer

Repository files navigation

Art Explorer

A modern web application for exploring artworks from The Metropolitan Museum of Art collection. Built with React, TypeScript, and Tailwind CSS.

🎨 Features

  • Browse Artworks: Explore thousands of artworks with infinite scroll
  • Advanced Search: Search by artist name or culture
  • Favorites: Save and manage your favorite artworks
  • Detailed View: View high-resolution images and detailed information
  • Dark Mode: Toggle between light and dark themes
  • Responsive Design: Optimized for mobile, tablet, and desktop
  • Scroll Restoration: Maintains scroll position when navigating back
  • Accessibility: WCAG compliant with keyboard navigation and screen reader support

πŸš€ Tech Stack

  • React 18 - UI library
  • TypeScript - Type safety
  • Vite - Build tool and dev server
  • TanStack Query (React Query) - Data fetching and caching
  • React Router - Client-side routing
  • Zustand - State management (favorites)
  • Tailwind CSS v4 - Styling
  • Axios - HTTP client
  • Met Museum API - Data source

πŸ› οΈ Installation

  1. Clone the repository:
git clone <repository-url>
cd agositnho_teles_jr
  1. Install dependencies:
npm install
  1. Start development server:
npm run dev
  1. Open in browser:
http://localhost:5173

πŸ“ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run ESLint

πŸ“¦ Project Structure

src/
β”œβ”€β”€ assets/          # SVG icons and images
β”œβ”€β”€ components/      # Reusable UI components
β”‚   β”œβ”€β”€ Buttons/     # Button components (Back, Hamburger, DayNight)
β”‚   β”œβ”€β”€ Gallery/     # Gallery grid and cards
β”‚   β”œβ”€β”€ Header/      # Header, Logo, Navigation
β”‚   β”œβ”€β”€ Layout/      # Page layouts
β”‚   └── SearchBar/   # Search input and results counter
β”œβ”€β”€ hooks/           # Custom React hooks
β”‚   β”œβ”€β”€ useMetMuseumArtworks.ts
β”‚   β”œβ”€β”€ useFavoritesArtworks.ts
β”‚   β”œβ”€β”€ useScrollRestoration.ts
β”‚   β”œβ”€β”€ useSearchState.ts
β”‚   β”œβ”€β”€ useToggle.ts
β”‚   └── usePrefetchMetObject.ts
β”œβ”€β”€ pages/           # Page components
β”‚   β”œβ”€β”€ Home.tsx
β”‚   β”œβ”€β”€ Favorites.tsx
β”‚   └── ArtDetails/
β”œβ”€β”€ services/        # API clients
β”‚   └── metMuseumApi.ts
β”œβ”€β”€ stores/          # Zustand stores
β”‚   └── useFavoritesStore.ts
β”œβ”€β”€ styles/          # CSS and themes
β”‚   β”œβ”€β”€ components/
β”‚   └── themes.css
β”œβ”€β”€ types/           # TypeScript type definitions
β”‚   └── metMuseum.ts
β”œβ”€β”€ utils/           # Utility functions
β”‚   └── transformers.ts
└── App.tsx          # Root component

🎯 Core Features Implementation

Data Fetching & Caching

  • Uses TanStack Query for efficient data fetching and caching
  • Prefetches artwork details on hover for instant navigation
  • 5-minute stale time for API responses
  • Automatic retry on failed requests

Infinite Scroll

  • Loads 15 artworks per page
  • Intersection Observer API for scroll detection
  • Smooth loading states with skeleton screens
  • Maintains performance with memoized components

Favorites System

  • Persistent storage using localStorage via Zustand
  • Optimistic UI updates
  • Separate view for favorite artworks
  • Real-time sync across components

Dark Mode

  • Class-based dark mode with Tailwind CSS v4
  • Persists preference to localStorage
  • Smooth transitions between themes
  • Custom color palette for consistent branding

Scroll Restoration

  • Saves scroll position to sessionStorage
  • Restores position when returning from detail pages
  • Multiple restoration attempts for reliability
  • Clears position on search/reset

🎨 Design Patterns & Best Practices

SOLID Principles

  • Single Responsibility: Each component/hook has one clear purpose
  • Open/Closed: Easy to extend without modifying existing code
  • Dependency Inversion: Components depend on abstractions (hooks), not implementations

Performance Optimizations

  • React.memo for expensive components
  • useCallback for stable function references
  • useMemo for derived data
  • Code splitting with React.lazy (ready for future use)
  • Image lazy loading and decoding optimization

Accessibility

  • Semantic HTML elements
  • ARIA attributes (roles, labels, states)
  • Keyboard navigation support
  • Focus management
  • Screen reader friendly
  • Sufficient color contrast ratios

🌐 API Integration

Uses The Metropolitan Museum of Art Collection API:

Endpoints:

  • GET /search - Search artworks by query
  • GET /objects/{objectID} - Get artwork details

Features:

  • Fallback search strategy (artist/culture β†’ general)
  • Error handling with Promise.allSettled
  • Response transformation to normalized format
  • Retry logic for failed requests

🎨 Styling

  • Tailwind CSS v4 with CSS variables
  • Custom color palette in themes.css
  • Component-scoped styles in @layer components
  • Responsive breakpoints (sm, md, lg, xl)
  • Dark mode variants with dark: prefix

πŸ”§ Configuration

TypeScript

  • Strict mode enabled
  • Path aliases configured (@/)
  • Type-safe API responses
  • Shared type definitions in /types

Vite

  • Fast HMR (Hot Module Replacement)
  • Optimized build output
  • Asset handling (SVG, images)
  • Path resolution

πŸ“± Browser Support

  • Modern browsers (Chrome, Firefox, Safari, Edge)
  • ES2020+ features
  • CSS Grid and Flexbox
  • Intersection Observer API

🚒 Deployment

Build for production:

npm run build

Output will be in dist/ folder.

Preview production build:

npm run preview

Deploy to:

  • Vercel (recommended)
  • Netlify
  • GitHub Pages
  • Any static hosting service

πŸ› Known Issues & Limitations

  • Met Museum API has rate limits (no auth required, but throttled)
  • Some artworks may not have images (filtered out)
  • API response times can vary
  • Search is case-insensitive for better UX

πŸ“„ License

This project is for educational/portfolio purposes. Artwork data provided by The Metropolitan Museum of Art Collection API.

πŸ‘€ Author

Agostinho Ferreira Teles Jr.

πŸ™ Acknowledgments

  • The Metropolitan Museum of Art for providing the API
  • React team for excellent documentation
  • TanStack Query for powerful data fetching
  • Tailwind CSS team for the utility-first framework

Built with ❀️ using React + TypeScript + Vite

About

A modern web app built with React, TypeScript, and Tailwind CSS that uses the Metropolitan Museum of Art API to let users browse through thousands of artworks with infinite scroll, search by artist or culture, save favorites, and view high-resolution details.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors