fix(SW-302): add back imageWidth fix

This commit is contained in:
Matilda Landström
2024-10-01 12:55:40 +02:00
parent 40c6ed0f20
commit c3fbd35cff

View File

@@ -11,7 +11,6 @@ import { cardVariants } from "./variants"
import styles from "./card.module.css" import styles from "./card.module.css"
import type { ImageVaultAsset } from "@/types/components/imageVault"
import type { CardProps } from "./card" import type { CardProps } from "./card"
export default function Card({ export default function Card({
@@ -32,12 +31,12 @@ export default function Card({
imageHeight = imageHeight || 320 imageHeight = imageHeight || 320
/*imageWidth = imageWidth =
imageWidth || imageWidth ||
(backgroundImage (backgroundImage && "dimensions" in backgroundImage
? backgroundImage.dimensions.aspectRatio * imageHeight ? backgroundImage.dimensions.aspectRatio * imageHeight
: 420) : 420)
*/
return ( return (
<article <article
className={cardVariants({ className={cardVariants({
@@ -51,7 +50,7 @@ export default function Card({
src={backgroundImage.url} src={backgroundImage.url}
className={styles.image} className={styles.image}
alt={backgroundImage.meta.alt || backgroundImage.title} alt={backgroundImage.meta.alt || backgroundImage.title}
width={420} width={imageWidth}
height={imageHeight} height={imageHeight}
/> />
</div> </div>