Next.js Discord

Discord Forum

Is a 20 images grid (500x150px) too heavy for most devices?

Unanswered
Brown bear posted this in #help-forum
Open in Discord
Brown bearOP
This grid is hard to run smoothly on most devices, except my desktop. I'm not rendering the images at higher resolution than needed. I tried testing with 100x100 images but the problem remains.

3 Replies

Brown bearOP
this is the card component:
export default function Card({ props, small, index }: { props: Groupbuy; small: boolean; index: number }) {
  const { id, title, start, end, price, category, collectionId, thumbnail } = props;

  const { dateToShow, endsSoon } = formatStartEndDate(start, end);
  const formattedCategory = category.charAt(0).toUpperCase() + category.slice(1);

  return (
    <Link href={`/groupbuys/${id}`}>
      <div className="relative">
        <Image src={`${cloudfront}/${collectionId}/${id}/${thumbnail}?thumb=100x100`} alt="Groupbuy image" width={100} height={150} className="z-0 w-full h-32 rounded-t-lg object-cover" priority={index < 5 ? true : false} />
        <p className={`z-20 absolute top-0 left-0 px-2 py-1 ml-1 mt-1 text-black font-bold ${small ? "text-xs" : "text-sm"} rounded-lg bg-category-${category}`}>
          {formattedCategory}
        </p>
      </div>
      <div className={`${small ? "h-28" : "h-28"} flex justify-between p-2`}>
        <div className="flex flex-col justify-between overflow-hidden">
          <p className={`${small ? "text-sm" : "text-2xl"} font-bold truncate`}>
            {title}
          </p>
          <div className="flex items-center">
            <BanknotesIcon className="h-5 w-5 mr-1" />
            <p className={small ? "text-sm mr-1" : "text-sm mr-3"}>
              Starting at:
            </p>
            <p className={`${small ? "text-xs p-1" : "px-2 py-1"} font-bold bg-white-400 dark:bg-black-200 rounded-lg`}>
              {price !== 0 ? `$${price}` : "N/A"}
            </p>
          </div>
          <div className="flex items-center">
            <ClockIcon className="h-5 w-5 mr-1 text-gray-500" />
            <p className={`${small ? "text-sm" : ""} truncate ${endsSoon ? "text-red-300" : "text-black dark:text-white"}`}>
              {dateToShow}
            </p>
          </div>
        </div>
      </div>
    </Link>
  );
}


(removed some css to make it fit)
Polar bear
Is yet with problem?
Loading a lot of images shouldn’t have caused any performance issues as the browsers will lazy load your images.
If you can’t run it smoothly on most mobile devices, it is probably some other problems in your code