mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-23 03:51:13 -05:00
Refactor: Implement Cloudflare Image Variants
This commit is contained in:
@@ -3,6 +3,7 @@ import { useNavigate } from 'react-router-dom';
|
||||
import { Card, CardContent } from '@/components/ui/card';
|
||||
import { Badge } from '@/components/ui/badge';
|
||||
import { Park } from '@/types/database';
|
||||
import { getCloudflareImageUrl } from '@/lib/cloudflareImageUtils';
|
||||
|
||||
interface ParkCardProps {
|
||||
park: Park;
|
||||
@@ -48,9 +49,15 @@ export function ParkCard({ park }: ParkCardProps) {
|
||||
<div className="aspect-[4/3] bg-gradient-to-br from-primary/20 via-secondary/20 to-accent/20 flex items-center justify-center relative">
|
||||
{(park.card_image_url || park.card_image_id) ? (
|
||||
<img
|
||||
src={park.card_image_url || `https://imagedelivery.net/${import.meta.env.VITE_CLOUDFLARE_ACCOUNT_HASH}/${park.card_image_id}/public`}
|
||||
src={park.card_image_url || getCloudflareImageUrl(park.card_image_id, 'card')}
|
||||
srcSet={park.card_image_id ? `
|
||||
${getCloudflareImageUrl(park.card_image_id, 'cardthumb')} 600w,
|
||||
${getCloudflareImageUrl(park.card_image_id, 'card')} 1200w
|
||||
` : undefined}
|
||||
sizes="(max-width: 640px) 600px, 1200px"
|
||||
alt={park.name}
|
||||
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"
|
||||
className="w-full h-full object-cover group-hover:scale-110 transition-transform duration-500"
|
||||
loading="lazy"
|
||||
/>
|
||||
) : (
|
||||
<div className="opacity-50 flex items-center justify-center">
|
||||
|
||||
Reference in New Issue
Block a user