Use next/image for all <img> tags

This commit is contained in:
Aarni Halinen
2021-01-16 18:21:42 +02:00
parent e0ff72ce7c
commit 6d5c0bebe9
9 changed files with 100 additions and 57 deletions
+2 -7
View File
@@ -1,4 +1,5 @@
import React from "react";
import Image from "next/image";
import styled from "styled-components";
import { colors } from "@theme/colors";
import { Link } from "@components/index";
@@ -19,12 +20,6 @@ const StyledCard = styled.article`
margin: 1rem;
text-align: center;
img {
width: 100%;
max-height: 300px;
margin-bottom: 1rem;
}
p {
font-size: 1rem;
text-overflow: ellipsis;
@@ -77,7 +72,7 @@ const WrappedCard: React.FC<WrappedCardProps> = ({
};
const datetime = new Date(start_time).toLocaleString("fi-FI", options);
const img = image ? (
<img src={image} alt={imageAlt} />
<Image src={image} alt={imageAlt} layout="responsive" width={0} height={0} objectFit="scale-down" />
) : null;
const button = (