Skip to content

Commit

Permalink
preload
Browse files Browse the repository at this point in the history
  • Loading branch information
GraemeFulton committed May 3, 2024
1 parent a6f7914 commit 58aedcb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions components/carousel/EmblaCarousel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ const EmblaCarousel = props => {
setCurrentImage(item.original);
setDialogOpenImage(item.original);
}}
placeholder={item.base64?"blur":"empty"}
blurDataURL={item.base64?item.base64:""}
placeholder={(item.base64 && index<3)?"blur":"empty"}
blurDataURL={(item.base64 && index<3)?item.base64:""}
loader={gumletLoader}
// layout="fill"
width={300}
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/buildGallery.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const buildToolboxGallery = async ({ item, featuredImage }) => {
let PHOTO_SET = [];
// new gallry
if (item && item.attributes.gallery?.data?.length) {
for (var x = 0; x < item.attributes.gallery.data?.length; x++) {
for (var x = 0; (x < item.attributes.gallery.data?.length && x<3); x++) {
const galleryItem = item.attributes.gallery.data[x];
const base64 = await createBase64(galleryItem.attributes.url);

Expand Down Expand Up @@ -42,7 +42,7 @@ const buildToolboxGallery = async ({ item, featuredImage }) => {
item.attributes.legacyMedia.gallery &&
item.attributes.legacyMedia.gallery.length
) {
for (var x = 0; x < item.attributes.legacyMedia?.gallery?.length; x++) {
for (var x = 0;( x < item.attributes.legacyMedia?.gallery?.length && x<3); x++) {
const galleryItem = item.attributes.legacyMedia.gallery[x];
const base64 = await createBase64(galleryItem.medium);
//make nextjs preload the gumlet image
Expand Down
2 changes: 0 additions & 2 deletions pages/toolbox/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,6 @@ export async function getStaticProps({ params, preview = null, locale }) {

const PHOTO_SET = await buildToolboxGallery({ item, featuredImage });

console.log(PHOTO_SET.length, "PHOTO_SET.length");

const date = isoToReadableDate(postData.attributes.date);
const updatedAtDate = isoToReadableDate(postData.attributes.updatedAt);

Expand Down

0 comments on commit 58aedcb

Please sign in to comment.