Skip to content

Commit daaff91

Browse files
committed
fix image imports to constant
1 parent 85a5e81 commit daaff91

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

frontend/components/listings/ListingsCard.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Calendar } from "lucide-react";
44
import { Badge } from "@/components/ui/badge";
55
import { formatPrice, formatCondition, formatDate } from "@/lib/utils";
66
import { Item, Sublet } from "@/lib/types";
7-
import defaultImage from "@/public/images/default-image.jpg";
7+
8+
const DEFAULT_IMAGE = "/images/default-image.jpg";
89

910
interface Props {
1011
listing: Item | Sublet;
@@ -62,7 +63,7 @@ export const ListingsCard = ({ listing, previewImageUrl, href, isMyListing = fal
6263
{/* image container */}
6364
<div className="relative aspect-square w-full overflow-hidden bg-gray-100">
6465
<Image
65-
src={previewImageUrl || defaultImage}
66+
src={previewImageUrl || DEFAULT_IMAGE}
6667
alt={listing.title}
6768
fill
6869
className="object-cover transition-transform duration-200 group-hover:scale-105"

frontend/components/listings/detail/ListingImageGallery.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
import Image from "next/image";
44
import { useState } from "react";
5-
import defaultImage from "@/public/images/default-image.jpg";
65
import { cn } from "@/lib/utils";
76

7+
const DEFAULT_IMAGE = "/images/default-image.jpg";
8+
89
interface Props {
910
images: string[];
1011
}
@@ -17,7 +18,7 @@ export const ListingImageGallery = ({ images }: Props) => {
1718
<div className="relative h-[400px] overflow-hidden rounded-2xl md:h-[450px] lg:h-[500px]">
1819
{/* blurred background */}
1920
<Image
20-
src={images[selectedImage] || defaultImage}
21+
src={images[selectedImage] || DEFAULT_IMAGE}
2122
alt="Background"
2223
fill
2324
className="scale-110 object-cover opacity-50 blur-2xl"
@@ -27,7 +28,7 @@ export const ListingImageGallery = ({ images }: Props) => {
2728
{/* main selected image */}
2829
<div className="relative flex h-full w-full items-center justify-center">
2930
<Image
30-
src={images[selectedImage] || defaultImage}
31+
src={images[selectedImage] || DEFAULT_IMAGE}
3132
alt="Listing image"
3233
fill
3334
className="object-contain"

0 commit comments

Comments
 (0)