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
+8 -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 { Event } from "@models/Event";
@@ -21,10 +22,6 @@ const StyledTextSection = styled(TextSection)`
p {
color: ${colors.orange1};
}
img {
width: 100%;
}
}
`;
@@ -47,9 +44,13 @@ const EventPageView: React.FC<EventPageViewProps> = ({ event }) => {
<p>
{event.description_fi}
</p>
<div>
<img src={event.image || event.tags[0].icon} alt={event.title_fi} />
</div>
<Image
src={event.image || event.tags[0].icon}
alt={event.title_fi}
layout="responsive"
width={0}
height={0}
/>
</h1>
<div>
<Content source={event.content_fi} escapeHtml={false} />