From d73f91150855a97b8dc830a83572cbaaf1d95356 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 22 Feb 2022 15:06:09 +0100
Subject: chore(homepage): use next/image for images and specify width/height

---
 .../MDX/ResponsiveImage/ResponsiveImage.tsx          | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

(limited to 'src/components/MDX/ResponsiveImage/ResponsiveImage.tsx')

diff --git a/src/components/MDX/ResponsiveImage/ResponsiveImage.tsx b/src/components/MDX/ResponsiveImage/ResponsiveImage.tsx
index 062c04b..6c39e7f 100644
--- a/src/components/MDX/ResponsiveImage/ResponsiveImage.tsx
+++ b/src/components/MDX/ResponsiveImage/ResponsiveImage.tsx
@@ -1,12 +1,8 @@
-import Image, { ImageProps } from 'next/image';
+import { ResponsiveImageProps } from '@ts/types/app';
+import Image from 'next/image';
 import Link from 'next/link';
 import styles from './ResponsiveImage.module.scss';
 
-type ResponsiveImageProps = ImageProps & {
-  caption?: string;
-  linkTarget?: string;
-};
-
 const ResponsiveImage = (props: ResponsiveImageProps) => {
   const { caption, linkTarget, ...attributes } = props;
 
@@ -15,7 +11,11 @@ const ResponsiveImage = (props: ResponsiveImageProps) => {
       {linkTarget ? (
         <Link href={linkTarget}>
           <a className={styles.link}>
-            <Image alt={attributes.alt} layout="intrinsic" {...attributes} />
+            <Image
+              alt={attributes.alt}
+              layout={attributes.layout || 'intrinsic'}
+              {...attributes}
+            />
             {caption && (
               <figcaption className={styles.caption}>{caption}</figcaption>
             )}
@@ -23,7 +23,11 @@ const ResponsiveImage = (props: ResponsiveImageProps) => {
         </Link>
       ) : (
         <>
-          <Image alt={attributes.alt} layout="intrinsic" {...attributes} />
+          <Image
+            alt={attributes.alt}
+            layout={attributes.layout || 'intrinsic'}
+            {...attributes}
+          />
           {caption && (
             <figcaption className={styles.caption}>{caption}</figcaption>
           )}
-- 
cgit v1.2.3

