Ajout d'images pour les cartes de lieux (restaurants, plages, épiceries)
- Téléchargement d'images depuis Unsplash - Images stockées dans public/images/ - Mise à jour de places.json avec chemins locaux - Composant PlaceCard affiche maintenant les images dans l'en-tête - Fallback automatique vers placeholder si image manquante
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
import { MapPin, ExternalLink } from "lucide-react";
|
||||
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
@ -10,6 +11,9 @@ interface PlaceCardProps {
|
||||
}
|
||||
|
||||
export default function PlaceCard({ place }: PlaceCardProps) {
|
||||
const [imageError, setImageError] = useState(false);
|
||||
const hasValidImage = place.image && place.image !== "";
|
||||
|
||||
const handleOpenMaps = () => {
|
||||
let url: string;
|
||||
if (place.gmapLink && place.gmapLink !== "LIEN_GOOGLE_MAPS_A_INSERER") {
|
||||
@ -22,10 +26,19 @@ export default function PlaceCard({ place }: PlaceCardProps) {
|
||||
|
||||
return (
|
||||
<Card className="overflow-hidden">
|
||||
<div className="relative h-48 bg-gradient-to-br from-primary/20 to-secondary">
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<MapPin className="h-16 w-16 text-primary/30" />
|
||||
</div>
|
||||
<div className="relative h-48 bg-gradient-to-br from-primary/20 to-secondary overflow-hidden">
|
||||
{hasValidImage && !imageError ? (
|
||||
<img
|
||||
src={place.image}
|
||||
alt={place.name}
|
||||
className="w-full h-full object-cover"
|
||||
onError={() => setImageError(true)}
|
||||
/>
|
||||
) : (
|
||||
<div className="absolute inset-0 flex items-center justify-center">
|
||||
<MapPin className="h-16 w-16 text-primary/30" />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
<CardHeader>
|
||||
<div className="flex items-start justify-between gap-2">
|
||||
|
||||
Reference in New Issue
Block a user