From 29a699d886af2a3be1d6be53a743571cc3019232 Mon Sep 17 00:00:00 2001 From: "D. Ror" Date: Thu, 2 May 2024 17:57:47 -0400 Subject: [PATCH] [Landing Page] Improve layout (#3078) --- src/components/HarvestThreshWinnow/index.tsx | 20 +++--- src/components/LandingPage/BottomBar.tsx | 53 +++++++--------- src/components/LandingPage/LandingButtons.tsx | 62 +++++++++---------- src/components/LandingPage/TopBar.tsx | 26 ++++---- src/components/LandingPage/index.tsx | 47 ++++++-------- 5 files changed, 97 insertions(+), 111 deletions(-) diff --git a/src/components/HarvestThreshWinnow/index.tsx b/src/components/HarvestThreshWinnow/index.tsx index 5fb7e91582..3972c3ddca 100644 --- a/src/components/HarvestThreshWinnow/index.tsx +++ b/src/components/HarvestThreshWinnow/index.tsx @@ -30,8 +30,8 @@ const imageMetadata: ImageMetadata[] = [ ]; interface HarvestThreshWinnowProps { + height?: number; loading?: boolean; - maxSize?: number; } // Opacity of the 3 images, each fading in then fading out while the next fades in. @@ -57,28 +57,28 @@ export default function HarvestThreshWinnow( } }, [props.loading]); - const size = Math.min( + const imageSize = Math.min( 0.75 * window.innerHeight, 0.25 * window.innerWidth, - props.maxSize || 1000 + props.height || 1000 ); const imageStyle: CSSProperties = { border: "1px solid black", - borderRadius: size, + borderRadius: imageSize, + height: imageSize, position: "relative", - width: size, }; const overlap = 0.23; return ( -
+
{ImageAlt.Harvest} {ImageAlt.Thresh}
- +
); diff --git a/src/components/LandingPage/BottomBar.tsx b/src/components/LandingPage/BottomBar.tsx index a6a0133ebb..23ee2e9348 100644 --- a/src/components/LandingPage/BottomBar.tsx +++ b/src/components/LandingPage/BottomBar.tsx @@ -1,4 +1,4 @@ -import { AppBar, Button, Grid, Toolbar, Typography } from "@mui/material"; +import { AppBar, Button, Stack, Toolbar, Typography } from "@mui/material"; import { ReactElement } from "react"; import { useTranslation } from "react-i18next"; @@ -15,38 +15,33 @@ export default function BottomBar(): ReactElement {
- - - {combineAppRelease} - - - - - + {combineAppRelease} + +
diff --git a/src/components/LandingPage/LandingButtons.tsx b/src/components/LandingPage/LandingButtons.tsx index f9576ee4a6..5295d8c34e 100644 --- a/src/components/LandingPage/LandingButtons.tsx +++ b/src/components/LandingPage/LandingButtons.tsx @@ -1,4 +1,5 @@ -import { Button, Card, Grid, Typography } from "@mui/material"; +import { Info } from "@mui/icons-material"; +import { Button, Card, Stack, Typography } from "@mui/material"; import { ReactElement } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; @@ -9,15 +10,13 @@ import { openUserGuide } from "utilities/pathUtilities"; const idAffix = "landing"; -const buttonHeight = 50; -const buttonWidth = 145; - -export const horizontalButtonsHeight = - buttonHeight + parseInt(theme.spacing(2)); -const horizontalButtonsWidth = 3 * buttonWidth + parseInt(theme.spacing(7)); - -const verticalButtonsHeight = 3 * buttonHeight + parseInt(theme.spacing(7)); -export const verticalButtonsWidth = buttonWidth + parseInt(theme.spacing(2)); +const buttonHeight = 56; +const buttonWidth = 144; +const iconButtonWidth = buttonWidth / 4; +const gap = parseInt(theme.spacing(1)); +export const horizontalButtonsHeight = buttonHeight + gap; +const horizontalButtonsWidth = 2 * buttonWidth + iconButtonWidth + 2 * gap; +export const verticalButtonsWidth = buttonWidth + 2 * gap; interface LandingButtonsProps { top?: boolean; @@ -28,17 +27,11 @@ export default function LandingButtons( ): ReactElement { const navigate = useNavigate(); return ( - - + openUserGuide()} textId="userMenu.userGuide" buttonId={`${idAffix}-guide`} + icon={props.top ? : undefined} /> - + ); } @@ -77,21 +71,27 @@ interface LandingButtonProps { textId: string; buttonId: string; filled?: boolean; + icon?: ReactElement; } + +/** Button for the Landing Page. (Prop `icon` overrides `textId`.) */ function LandingButton(props: LandingButtonProps): ReactElement { const { t } = useTranslation(); return ( - - - + )} + ); } diff --git a/src/components/LandingPage/TopBar.tsx b/src/components/LandingPage/TopBar.tsx index 194fe001f1..9b67e40819 100644 --- a/src/components/LandingPage/TopBar.tsx +++ b/src/components/LandingPage/TopBar.tsx @@ -1,4 +1,4 @@ -import { AppBar, Grid, Hidden, Toolbar, Typography } from "@mui/material"; +import { AppBar, Hidden, Stack, Toolbar, Typography } from "@mui/material"; import { ReactElement } from "react"; import { useTranslation } from "react-i18next"; @@ -14,23 +14,21 @@ export default function TopBar(): ReactElement {
- - - Logo - - - - - {t("landingPage.subtitle")} - - + Logo + + {t("landingPage.subtitle")} + + + {t("landingPage.subtitle")} - +
diff --git a/src/components/LandingPage/index.tsx b/src/components/LandingPage/index.tsx index 33e5b7099c..98c94533f1 100644 --- a/src/components/LandingPage/index.tsx +++ b/src/components/LandingPage/index.tsx @@ -1,4 +1,4 @@ -import { Box, Grid, Hidden, Typography } from "@mui/material"; +import { Box, Grid, Hidden, Stack, Typography } from "@mui/material"; import { ReactElement, useEffect } from "react"; import { useTranslation } from "react-i18next"; import { useNavigate } from "react-router-dom"; @@ -6,8 +6,8 @@ import { useNavigate } from "react-router-dom"; import HarvestThreshWinnow from "components/HarvestThreshWinnow"; import BottomBar, { bottomBarHeight } from "components/LandingPage/BottomBar"; import LandingButtons, { - horizontalButtonsHeight, SignUpButton, + horizontalButtonsHeight, verticalButtonsWidth, } from "components/LandingPage/LandingButtons"; import TopBar, { topBarHeight } from "components/LandingPage/TopBar"; @@ -31,22 +31,22 @@ export default function LandingPage(): ReactElement { return ( <> - + - + - + - + - + -
+ + {t("landingPage.descriptionP1")} {
} @@ -86,18 +79,18 @@ function Body(): ReactElement { {t("landingPage.descriptionP3")} {
}
- + {t("landingPage.descriptionP4")} -
- - -
+ + + + + + + + ); }