Skip to content

Commit 289f589

Browse files
refactor(ContentHero): constrain image component styling
1 parent 1a2319f commit 289f589

File tree

5 files changed

+18
-7
lines changed

5 files changed

+18
-7
lines changed

src/components/Hero/ContentHero/ContentHero.stories.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ export const ContentHero: StoryObj = {
4949
return (
5050
<ContentHeroComponent
5151
breadcrumbs={{ slug: "/en/run-a-node/" }}
52-
heroImg="/mainnet.png"
52+
heroImg="/upgrades/merge.png"
53+
// Can not properly hardcode this URL. So it's left blank
54+
blurDataURL=""
5355
title={t("hero-header")}
5456
description={t("hero-subtitle")}
5557
buttons={buttons}

src/components/Hero/ContentHero/index.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,26 @@ import { CallToAction } from "../CallToAction"
1010
export type ContentHeroProps = Omit<CommonHeroProps<string>, "header">
1111

1212
const ContentHero = (props: ContentHeroProps) => {
13-
const { breadcrumbs, heroImg, buttons, title, description } = props
13+
const { breadcrumbs, heroImg, buttons, title, description, blurDataURL } =
14+
props
1415
return (
1516
<Box bgImg="bgMainGradient">
16-
<SimpleGrid columns={{ base: 1, lg: 2 }} maxW="1536px" mx="auto" gap="4">
17+
<SimpleGrid columns={{ base: 1, lg: 2 }} maxW="1536px" mx="auto">
1718
<Box
18-
height={{ base: "300px", md: "400px", lg: "full" }}
1919
order={{ lg: 1 }}
20+
height={{ base: "300px", md: "400px", lg: "full" }}
2021
>
2122
<Image
2223
src={heroImg}
2324
alt=""
2425
priority
25-
style={{ objectFit: "contain" }}
26+
blurDataURL={blurDataURL}
27+
width={760}
28+
height={451}
29+
sizes="100vw"
2630
boxSize="full"
31+
style={{ objectFit: "contain" }}
32+
flex={{ base: "1 1 100%", md: "none" }}
2733
/>
2834
</Box>
2935
<Stack p={{ base: "8", lg: "16" }} spacing="9" justify="center">

src/components/Hero/HomeHero/index.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { StaticImageData } from "next/image"
21
import { useTranslation } from "next-i18next"
32
import { Box, Heading, Stack, Text, VStack } from "@chakra-ui/react"
43

src/components/Hero/HubHero/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { CommonHeroProps } from "@/lib/types"
55
import { CallToAction } from "@/components/Hero/CallToAction"
66
import { Image } from "@/components/Image"
77

8-
export type HubHeroProps = Omit<CommonHeroProps, "breadcrumbs">
8+
export type HubHeroProps = Omit<CommonHeroProps, "breadcrumbs" | "blurDataURL">
99

1010
const HubHero = ({
1111
heroImg,

src/lib/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,10 @@ export type CommonHeroProps<
391391
* for the given hero component.
392392
*/
393393
heroImg: HeroImg
394+
/**
395+
* File path for the image to show on prerender.
396+
*/
397+
blurDataURL: string
394398
/**
395399
* Object of props to render the `Breadcrumbs` component.
396400
*/

0 commit comments

Comments
 (0)