diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index c30d37e..6f4191d 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,9 +1,7 @@ - import { Routes, Route } from "react-router-dom"; -import './index.css' -import HomePage from './pages/HomePage' +import "./index.css"; +import HomePage from "./pages/HomePage"; import Login from "./pages/login"; -import Artworks from "./pages/Artworks"; function App() { return ( diff --git a/frontend/src/components/ArtworkCard.css b/frontend/src/components/ArtworkCard.css index 737ab3f..6da270d 100644 --- a/frontend/src/components/ArtworkCard.css +++ b/frontend/src/components/ArtworkCard.css @@ -38,4 +38,4 @@ margin: 0; color: #595959; overflow-wrap: anywhere; -} \ No newline at end of file +} diff --git a/frontend/src/components/ArtworkCard.tsx b/frontend/src/components/ArtworkCard.tsx index 897e1c8..bf0aebd 100644 --- a/frontend/src/components/ArtworkCard.tsx +++ b/frontend/src/components/ArtworkCard.tsx @@ -1,20 +1,16 @@ -import { useState } from 'react' -import type { Artwork } from '../types/Artwork' -import './ArtworkCard.css' +import { useState } from "react"; +import type { Artwork } from "../types/Artwork"; +import "./ArtworkCard.css"; type ArtworkCardProps = { - artwork: Artwork -} + artwork: Artwork; +}; function ArtworkImage({ src, alt }: { src: string; alt: string }) { - const [hasError, setHasError] = useState(false) + const [hasError, setHasError] = useState(false); if (hasError) { - return ( -
- Image unavailable -
- ) + return
Image unavailable
; } return ( @@ -25,28 +21,26 @@ function ArtworkImage({ src, alt }: { src: string; alt: string }) { loading="lazy" onError={() => setHasError(true)} /> - ) + ); } export default function ArtworkCard({ artwork }: ArtworkCardProps) { - const artist = artwork.artist?.trim() || 'Unknown artist' + const artist = artwork.artist_display?.trim() || "Unknown artist"; return (
- {artwork.imageUrl ? ( + {artwork.image_url ? ( ) : ( -
- Image unavailable -
+
Image unavailable
)}

{artwork.title}

{artist}

- ) -} \ No newline at end of file + ); +} diff --git a/frontend/src/components/ArtworkGrid.css b/frontend/src/components/ArtworkGrid.css index 904c56e..e1cd20f 100644 --- a/frontend/src/components/ArtworkGrid.css +++ b/frontend/src/components/ArtworkGrid.css @@ -1,11 +1,13 @@ .artwork-grid { display: grid; - grid-template-columns: minmax(0, 1fr); - align-items: start; - gap: 20px; - margin: 0; - padding: 0; + grid-template-columns: repeat(auto-fill, minmax(220px, 280px)); + gap: 24px; + + justify-content: center; + list-style: none; + padding: 0; + margin: 5rem 2rem 5rem 2rem; } .artwork-grid > li { @@ -16,4 +18,4 @@ .artwork-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } -} \ No newline at end of file +} diff --git a/frontend/src/components/Hero.tsx b/frontend/src/components/Hero.tsx index 38d3c00..8eecfb6 100644 --- a/frontend/src/components/Hero.tsx +++ b/frontend/src/components/Hero.tsx @@ -10,7 +10,7 @@ function Hero() { to="/login" aria-label="Open login" className="absolute left-10 top-15 text-gray-300 hover:text-gray-500" - > + > @@ -18,25 +18,27 @@ function Hero() {

Artex

- Explore thousands of artworks in the Art Institute of Chiacago’s collection. From their renowned icons to lesser known works from every corner of the globe. + Explore thousands of artworks in the Metropolitan Museum´s collection. + From their renowned icons to lesser known works from every corner of + the globe.

Featured artwork
); } -export default Hero; \ No newline at end of file +export default Hero; diff --git a/frontend/src/pages/Artworks.tsx b/frontend/src/pages/Artworks.tsx deleted file mode 100644 index 591bb6a..0000000 --- a/frontend/src/pages/Artworks.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { useArtworks } from "../hooks/useArtworks"; - -export default function Artworks() { - const { artworks, loading, error } = useArtworks(); - - if (loading) return

Loading artworks...

; - if (error) return

Error: {error}

; - - return ( -
-

Artex gallery

-

Number of artworks: {artworks.length}

-
- {artworks.map((artwork) => ( -
-

{artwork.title}

-

{artwork.artist_display || "Unknown artist"}

- - {artwork.image_url && ( - {artwork.title} - )} -
- ))} -
-
- ); -} diff --git a/frontend/src/pages/HomePage.tsx b/frontend/src/pages/HomePage.tsx index a6679ff..698d708 100644 --- a/frontend/src/pages/HomePage.tsx +++ b/frontend/src/pages/HomePage.tsx @@ -1,11 +1,17 @@ +import ArtworkGrid from "../components/ArtworkGrid"; import Hero from "../components/Hero"; +import { useArtworks } from "../hooks/useArtworks"; + +export default function HomePage() { + const { artworks, loading, error } = useArtworks(); + + if (loading) return

Loading artworks...

; + if (error) return

Error: {error}

; -function HomePage() { return (
+
); } - -export default HomePage; \ No newline at end of file