Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support image src with no protocol #60

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/modules/products/components/image-gallary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ const ImageGallery = ({ images }: ImageGalleryProps) => {
>
<span className="sr-only">Go to image {index + 1}</span>
<Image
src={image.url}
src={
image.url.startsWith("//") ? `https:${image.url}` : image.url
}
layout="fill"
objectFit="cover"
className="absolute inset-0"
Expand All @@ -54,7 +56,9 @@ const ImageGallery = ({ images }: ImageGalleryProps) => {
id={image.id}
>
<Image
src={image.url}
src={
image.url.startsWith("//") ? `https:${image.url}` : image.url
}
layout="fill"
objectFit="cover"
priority={index <= 2 ? true : false}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/products/components/thumbnail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const ImageOrPlaceholder = ({
}: Pick<ThumbnailProps, "size"> & { image?: string }) => {
return image ? (
<Image
src={image}
src={image.startsWith("//") ? `https:${image}` : image}
alt="Thumbnail"
layout="fill"
objectFit="cover"
Expand Down