Skip to content

Commit 92ce1d8

Browse files
authored
Merge pull request #140 from ethereum/fix-hero-images
Fix hero images
2 parents fcd8257 + 094f8cd commit 92ce1d8

File tree

5 files changed

+48
-58
lines changed

5 files changed

+48
-58
lines changed

src/components/Image.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const imageProps: (keyof NextImageProps)[] = [
2626
"referrerPolicy",
2727
"sizes",
2828
"src",
29+
"style",
2930
"useMap",
3031
]
3132

src/layouts/Roadmap.tsx

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {
22
Box,
3+
Center,
34
Flex,
45
Show,
56
SimpleGrid,
@@ -50,7 +51,7 @@ const HeroContainer = (props: ChildOnlyProp) => (
5051
)
5152

5253
const TitleCard = (props: ChildOnlyProp) => (
53-
<Flex w="full" p={8} direction="column" justify="flex-start" {...props} />
54+
<Flex p={8} direction="column" justify="flex-start" {...props} />
5455
)
5556

5657
// Roadmap layout components
@@ -132,10 +133,15 @@ export const RoadmapLayout: React.FC<IProps> = ({
132133
return (
133134
<Box position="relative">
134135
<HeroContainer>
135-
<Flex w="100%" flexDirection={{ base: "column", md: "row" }}>
136+
<Flex
137+
w="full"
138+
flexDirection={{ base: "column", lg: "row" }}
139+
justify="space-between"
140+
>
136141
<TitleCard>
137142
{/* TODO: Double check this slug works */}
138-
<Breadcrumbs slug={slug} /> <Title>{frontmatter.title}</Title>
143+
<Breadcrumbs slug={slug} mb="8" />
144+
<Title>{frontmatter.title}</Title>
139145
<OldText>{frontmatter.description}</OldText>
140146
{frontmatter?.buttons && (
141147
// FIXME: remove the `ul` override once removed the corresponding
@@ -168,26 +174,16 @@ export const RoadmapLayout: React.FC<IProps> = ({
168174
isMobile
169175
/>
170176
</TitleCard>
171-
<Image
172-
src={frontmatter.image}
173-
alt={frontmatter.alt ?? ""}
174-
style={{ objectFit: "contain" }}
175-
alignSelf={{
176-
base: "center",
177-
lg: "normal",
178-
}}
179-
bgRepeat="no-repeat"
180-
flex="1 1 100%"
181-
right={0}
182-
bottom={0}
183-
width={600}
184-
height={336}
185-
overflow="initial"
186-
maxW={{
187-
base: "538px",
188-
lg: "full",
189-
}}
190-
/>
177+
<Center>
178+
<Image
179+
src={frontmatter.image}
180+
alt={frontmatter.alt ?? ""}
181+
style={{ objectFit: "contain" }}
182+
width={700}
183+
height={345}
184+
priority
185+
/>
186+
</Center>
191187
</Flex>
192188
</HeroContainer>
193189
<Page dir={isRightToLeft ? "rtl" : "ltr"}>

src/layouts/Staking.tsx

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -274,22 +274,12 @@ export const StakingLayout: React.FC<IProps> = ({
274274
/>
275275
</Flex>
276276
<Image
277-
flex="1 1 100%"
278-
bgRepeat="no-repeat"
279-
right={0}
280-
bottom={0}
281-
maxW={{ base: "min(400px, 98%)", lg: "400px" }}
282-
width={400}
283-
height={340}
284-
maxH={{ base: "340px", lg: "none" }}
285-
boxSize={{ base: "full", lg: "auto" }}
286-
overflow={{ base: "initial", lg: "visible" }}
287-
alignSelf={{ base: "center", lg: "auto" }}
288277
src={frontmatter.image}
289278
alt={frontmatter.alt || ""}
290-
style={{
291-
objectFit: "contain",
292-
}}
279+
style={{ objectFit: "contain" }}
280+
width={400}
281+
height={340}
282+
priority
293283
/>
294284
</HeroContainer>
295285
<Page dir={isRightToLeft ? "rtl" : "ltr"}>

src/layouts/Upgrade.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Show,
1212
Text,
1313
useToken,
14+
Center,
1415
} from "@chakra-ui/react"
1516

1617
import type { ChildOnlyProp, Lang } from "@/lib/types"
@@ -195,17 +196,14 @@ export const UpgradeLayout: React.FC<IProps> = ({
195196
</TitleCard>
196197
{frontmatter.image && (
197198
<Image
198-
flex="1 1 100%"
199-
maxW="min(100%, 816px)"
200-
style={{ objectFit: "cover" }}
201-
alignSelf="center"
202-
right={0}
203-
bottom={0}
204-
width={600}
205-
height={600}
206-
overflow="initial"
207199
src={frontmatter.image}
208200
alt={frontmatter.alt}
201+
width={816}
202+
height={525}
203+
style={{ objectFit: "cover" }}
204+
priority
205+
flex={{ base: "1 1 100%", md: "none" }}
206+
alignSelf={{ base: "center", md: "flex-end" }}
209207
/>
210208
)}
211209
</HeroContainer>

src/layouts/UseCases.tsx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ const HeroContainer = (props: ChildOnlyProp) => (
3838
<Flex
3939
bg="cardGradient"
4040
boxShadow="inset 0px -1px 0px rgba(0, 0, 0, 0.1)"
41-
direction={{ base: "column-reverse", lg: "row" }}
42-
justify="end"
43-
minHeight={{ base: "800px", lg: "608px" }}
41+
flexDirection={{ base: "column-reverse", lg: "row" }}
42+
justifyContent="flex-end"
43+
minHeight="608px"
4444
maxHeight={{ base: "full", lg: "608px" }}
4545
width="full"
46-
position="relative"
4746
{...props}
4847
/>
4948
)
@@ -60,9 +59,10 @@ const TitleCard = (props: ChildOnlyProp) => {
6059
boxShadow={{ lg: boxShadow }}
6160
flexDirection="column"
6261
maxWidth={{ base: "full", lg: "container.sm" }}
62+
mt={{ base: 0, lg: 12 }}
6363
zIndex="docked"
6464
p={8}
65-
position="absolute"
65+
position={{ base: "relative", lg: "absolute" }}
6666
top={{ base: "unset", lg: 24 }}
6767
left={{ base: 0, lg: 24 }}
6868
bottom={{ base: 0, lg: "unset" }}
@@ -211,15 +211,20 @@ export const UseCasesLayout: React.FC<IProps> = ({
211211
</Box>
212212
</TitleCard>
213213
<Image
214-
position="absolute"
215-
alignSelf={{ base: "center", lg: "normal" }}
216-
top={0}
217-
bottom={0}
218-
style={{ objectFit: "cover" }}
219-
width={1000}
220-
height={610}
221214
src={frontmatter.image}
222215
alt={frontmatter.alt || ""}
216+
width={1200}
217+
height={610}
218+
style={{ objectFit: "cover" }}
219+
priority
220+
alignSelf={{
221+
base: "center",
222+
lg: "normal",
223+
}}
224+
maxH={{
225+
base: "340px",
226+
lg: "full",
227+
}}
223228
maxW={{
224229
base: useCase === "defi" ? "full" : "min(405px, 98%)",
225230
lg:

0 commit comments

Comments
 (0)