Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@ import { removeEdgesAndNodes } from '@bigcommerce/catalyst-client';

import { FragmentOf } from '~/client/graphql';
import { BcImage } from '~/components/bc-image';
import {
Gallery as ComponentsGallery,
GalleryContent,
GalleryControls,
GalleryImage,
GalleryThumbnail,
GalleryThumbnailItem,
GalleryThumbnailList,
} from '~/components/ui/gallery';
import { Gallery as ComponentsGallery } from '~/components/ui/gallery';

import { GalleryFragment } from './fragment';

Expand Down Expand Up @@ -46,42 +38,7 @@ export const Gallery = ({ product, noImageText }: Props) => {
return (
<div className="-mx-6 mb-10 sm:-mx-0 md:mb-12">
<div className="lg:sticky lg:top-0">
<ComponentsGallery defaultImageIndex={defaultImageIndex} images={images}>
<GalleryContent>
<GalleryImage>
{({ selectedImage }) =>
selectedImage ? (
<BcImage
alt={selectedImage.altText}
className="h-full w-full object-contain"
fill
priority={true}
sizes="(min-width: 1024px) 50vw, 100vw"
src={selectedImage.url}
/>
) : (
<div className="flex aspect-square items-center justify-center bg-gray-200">
<div className="text-base font-semibold text-gray-500">
{noImageText ?? 'Coming soon'}
</div>
</div>
)
}
</GalleryImage>
<GalleryControls />
</GalleryContent>
<GalleryThumbnailList className="px-6 sm:px-1">
{images.map((image, index) => {
return (
<GalleryThumbnailItem imageIndex={index} key={image.url}>
<GalleryThumbnail asChild>
<BcImage alt={image.altText} priority={true} src={image.url} />
</GalleryThumbnail>
</GalleryThumbnailItem>
);
})}
</GalleryThumbnailList>
</ComponentsGallery>
<ComponentsGallery defaultImageIndex={defaultImageIndex} images={images} />
</div>
</div>
);
Expand Down
Loading