Skip to content

Commit

Permalink
Refactors carousel to use NextJS' Image component.
Browse files Browse the repository at this point in the history
  • Loading branch information
ncn-ssw committed Oct 15, 2024
1 parent 754fcb1 commit b2f237a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion components/blocks/CarouselFeature.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Image from 'next/image';
import React, { useEffect, useRef, useState } from 'react';
import { tinaField } from 'tinacms/dist/react';
import { sanitizeLabel } from 'utils/sanitizeLabel';
Expand Down Expand Up @@ -170,12 +171,16 @@ export function CarouselFeatureBlock({ data, index }) {
const fileExtension = fullVideoUrl.split('.').pop();

if (fileExtension === 'gif') {
// Width and height values *must* be provided to NextJS's Image component to build,
// but they will not determine the rendered size of the image in this case.
return (
<div className="flex justify-center items-center">
<img
<Image
key={index}
src={fullVideoUrl}
alt={`Media item ${index}`}
width={1200}
height={800}
className="w-full h-auto mt-10 lg:mt-0 rounded-xl shadow-lg"
/>
</div>
Expand Down

0 comments on commit b2f237a

Please sign in to comment.