Skip to content

Commit 59fb6b6

Browse files
authored
Merge pull request #191 from ethereum/page-hero-action-card
PageHero & ActionCard image refactors
2 parents 61ebf25 + f8965fc commit 59fb6b6

File tree

5 files changed

+12
-4
lines changed

5 files changed

+12
-4
lines changed

src/components/ActionCard.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { StaticImageData } from "next/image"
12
import type { ReactNode } from "react"
23
import {
34
Box,
@@ -10,7 +11,7 @@ import {
1011
useColorModeValue,
1112
} from "@chakra-ui/react"
1213

13-
import { Image, type ImageProps } from "@/components/Image"
14+
import { Image } from "@/components/Image"
1415
import { BaseLink } from "@/components/Link"
1516
import Text from "@/components/OldText"
1617

@@ -30,7 +31,8 @@ export type ActionCardProps = Omit<LinkBoxProps, "title"> & {
3031
children?: ReactNode
3132
to: string
3233
alt?: string
33-
image: ImageProps["src"]
34+
image: StaticImageData
35+
imageWidth?: number
3436
title: ReactNode
3537
description?: ReactNode
3638
className?: string
@@ -42,6 +44,7 @@ const ActionCard = ({
4244
to,
4345
alt,
4446
image,
47+
imageWidth = 220,
4548
title,
4649
description,
4750
children,
@@ -76,7 +79,8 @@ const ActionCard = ({
7679
>
7780
<Image
7881
src={image}
79-
width={220}
82+
width={imageWidth}
83+
maxH="full"
8084
alt={alt || ""}
8185
style={{ objectFit: "cover" }}
8286
/>

src/components/Hero/HomeHero/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const HomeHero = ({ heroImg }: HomeHeroProps) => {
1717
<Image
1818
src={heroImg}
1919
alt={t("page-index:page-index-hero-image-alt")}
20+
sizes="100vw"
2021
w="full"
2122
h="full"
2223
priority

src/components/PageHero.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ const PageHero = ({
155155
>
156156
<Image
157157
src={image}
158-
sizes="100%"
158+
sizes="(max-width: 992px) 100vw, 50vw"
159159
style={{
160160
width: "100%",
161161
height: "auto",

src/pages/community.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ const CommunityPage = () => {
304304
description={card.description}
305305
to={card.to}
306306
image={card.image}
307+
imageWidth={320}
307308
alt={card.alt}
308309
/>
309310
))}

src/pages/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,7 @@ const HomePage = ({
364364
alt={card.alt}
365365
to={card.to}
366366
image={card.image}
367+
imageWidth={320}
367368
/>
368369
))}
369370
</CardContainer>
@@ -572,6 +573,7 @@ const HomePage = ({
572573
alt={tout.alt}
573574
to={tout.to}
574575
image={tout.image}
576+
imageWidth={320}
575577
boxShadow={cardBoxShadow}
576578
/>
577579
)

0 commit comments

Comments
 (0)