Skip to content

Commit 75b29fb

Browse files
authored
Merge pull request #3684 from IntersectMBO/revert/3622
revert(#3683): revert changes introduced in #3622
2 parents 475458e + 5b73fb1 commit 75b29fb

File tree

17 files changed

+332
-726
lines changed

17 files changed

+332
-726
lines changed

govtool/frontend/src/components/atoms/Typography.tsx

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,8 @@ export const Typography = ({
1212
headline3: 36,
1313
headline4: 32,
1414
headline5: 28,
15-
title: 27,
1615
title1: 24,
17-
titleH3: 23,
1816
title2: 22,
19-
body: 21,
2017
body1: 16,
2118
body2: 14,
2219
caption: 12,
@@ -28,11 +25,8 @@ export const Typography = ({
2825
headline3: 400,
2926
headline4: 600,
3027
headline5: 500,
31-
title: 500,
3228
title1: 400,
33-
titleH3: 500,
3429
title2: 500,
35-
body: 400,
3630
body1: 600,
3731
body2: 500,
3832
caption: 400,
@@ -44,11 +38,8 @@ export const Typography = ({
4438
headline3: "44px",
4539
headline4: "40px",
4640
headline5: "36px",
47-
title: "32px",
48-
titleH3: "32px",
4941
title1: "32px",
5042
title2: "28px",
51-
body: "28px",
5243
body1: "24px",
5344
body2: "20px",
5445
caption: "16px",

govtool/frontend/src/components/atoms/types.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,8 @@ export type TypographyProps = Pick<
3232
| "headline3"
3333
| "headline4"
3434
| "headline5"
35-
| "title"
36-
| "titleH3"
3735
| "title1"
3836
| "title2"
39-
| "body"
4037
| "body1"
4138
| "body2"
4239
| "caption";

govtool/frontend/src/components/molecules/Card.tsx

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
import { Chip, Paper, SxProps, PaperProps } from "@mui/material";
1+
import { Chip, Paper, SxProps } from "@mui/material";
22
import { Theme } from "@mui/material/styles";
33
import { PropsWithChildren } from "react";
44

55
import { errorRed, orange, primaryBlue, successGreen } from "@/consts";
66

7-
type CardProps = Omit<PaperProps, "variant"> &
8-
PropsWithChildren & {
9-
border?: boolean;
10-
elevation?: number;
11-
dataTestId?: string;
12-
label?: string;
13-
labelDataTestId?: string;
14-
sx?: SxProps<Theme>;
15-
variant?: "default" | "error" | "primary" | "success" | "warning";
16-
onCardClick?: () => void;
17-
};
7+
type CardProps = PropsWithChildren & {
8+
border?: boolean;
9+
elevation?: number;
10+
dataTestId?: string;
11+
label?: string;
12+
labelDataTestId?: string;
13+
sx?: SxProps<Theme>;
14+
variant?: "default" | "error" | "primary" | "success" | "warning";
15+
onCardClick?: () => void;
16+
};
1817

1918
const COLORS = {
2019
default: {
@@ -49,22 +48,14 @@ export const Card = ({
4948
labelDataTestId = "card-label",
5049
sx,
5150
onCardClick,
52-
...props
5351
}: CardProps) => {
5452
const colors = COLORS[variant];
5553

5654
return (
5755
<Paper
58-
{...props}
5956
elevation={elevation}
6057
data-testid={dataTestId}
6158
onClick={onCardClick}
62-
onKeyDown={(e) => {
63-
if (e.key === "Enter" || e.key === " ") {
64-
e.preventDefault();
65-
onCardClick?.();
66-
}
67-
}}
6859
sx={{
6960
backgroundColor: (theme) =>
7061
colors.backgroundColor ?? `${theme.palette.neutralWhite}4D`,

govtool/frontend/src/components/molecules/HomeCard.tsx

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import { useMemo } from "react";
2+
import { Trans } from "react-i18next";
3+
import { Box, Link } from "@mui/material";
4+
import { ArrowDownward } from "@mui/icons-material";
5+
6+
import { Button, Typography } from "@atoms";
7+
import { IMAGES } from "@consts";
8+
import { useScreenDimension, useTranslation } from "@hooks";
9+
import { openInNewTab } from "@utils";
10+
11+
export const Hero = () => {
12+
const { isMobile, screenWidth } = useScreenDimension();
13+
const { t } = useTranslation();
14+
const IMAGE_SIZE = screenWidth < 640 ? 300 : screenWidth < 860 ? 400 : 600;
15+
16+
const paddingHorizontal = useMemo(() => {
17+
if (screenWidth < 640) return 3;
18+
if (screenWidth < 1512) return 9.375;
19+
if (screenWidth < 1728) return 14;
20+
if (screenWidth < 1920) return 27.375;
21+
if (screenWidth < 2560) return 39.375;
22+
return 49.25;
23+
}, [screenWidth]);
24+
25+
const imageRightMargin = useMemo(() => {
26+
if (screenWidth <= 860) return -(IMAGE_SIZE / 4);
27+
if (screenWidth <= 1440) return -(IMAGE_SIZE / 15);
28+
if (screenWidth <= 1728) return screenWidth / 20;
29+
return screenWidth / 11;
30+
}, [screenWidth]);
31+
32+
const onClickVotingPower = () =>
33+
openInNewTab("https://docs.cardano.org/about-cardano/governance-overview");
34+
35+
return (
36+
<Box
37+
alignItems="center"
38+
display="flex"
39+
flex={1}
40+
marginTop={16}
41+
flexDirection="row"
42+
overflow="visible"
43+
position="relative"
44+
px={paddingHorizontal}
45+
>
46+
<Box alignItems="center" flex={1} height="min-content">
47+
<Typography
48+
variant={screenWidth < 860 ? "headline2" : "headline1"}
49+
sx={{ whiteSpace: "pre-line" }}
50+
{...(screenWidth < 430 && { fontSize: 50 })}
51+
>
52+
{t("hero.headline")}
53+
</Typography>
54+
<Typography
55+
fontWeight={400}
56+
sx={{
57+
maxWidth: 725,
58+
my: 4,
59+
whiteSpace: "pre-line",
60+
}}
61+
variant="title2"
62+
>
63+
<Trans
64+
i18nKey="hero.description"
65+
components={[
66+
<Link
67+
data-testid="voting-power-link"
68+
onClick={onClickVotingPower}
69+
sx={{
70+
cursor: "pointer",
71+
}}
72+
/>,
73+
]}
74+
/>
75+
</Typography>
76+
<Button
77+
data-testid="hero-connect-wallet-button"
78+
onClick={() => {
79+
const homeCards =
80+
window.document.getElementsByClassName("home-cards")[0];
81+
82+
homeCards.scrollIntoView({
83+
behavior: "smooth",
84+
block: "nearest",
85+
});
86+
}}
87+
endIcon={<ArrowDownward />}
88+
size={isMobile ? "medium" : "extraLarge"}
89+
>
90+
{t("hero.connectWallet")}
91+
</Button>
92+
</Box>
93+
<Box
94+
flex={1}
95+
position="absolute"
96+
right={imageRightMargin}
97+
top={-80}
98+
zIndex={-1}
99+
>
100+
<img
101+
alt="hero"
102+
src={IMAGES.heroImage}
103+
width={IMAGE_SIZE}
104+
height={IMAGE_SIZE}
105+
/>
106+
</Box>
107+
</Box>
108+
);
109+
};

0 commit comments

Comments
 (0)