Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Commit

Permalink
Move process page to app
Browse files Browse the repository at this point in the history
  • Loading branch information
acouch committed May 22, 2024
1 parent 6bfd75e commit 32ba4ee
Show file tree
Hide file tree
Showing 20 changed files with 630 additions and 278 deletions.
51 changes: 51 additions & 0 deletions frontend/src/app/[locale]/process/ProcessIntro.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { Grid } from "@trussworks/react-uswds";
import { useTranslations, useMessages } from "next-intl";
import ContentLayout from "src/components/ContentLayout";

const ProcessIntro = () => {
const t = useTranslations("Process");

const messages = useMessages() as unknown as IntlMessages;
const keys = Object.keys(messages.Process.intro.boxes);

return (
<ContentLayout
title={t("intro.title")}
data-testid="process-intro-content"
paddingTop={false}
>
<Grid row gap>
<Grid>
<p className="tablet-lg:font-sans-xl line-height-sans-3 usa-intro margin-top-2">
{t("intro.content")}
</p>
</Grid>
</Grid>

<Grid row gap="lg" className="margin-top-2">
{keys.map((key) => {
const title = t(`intro.boxes.${key}.title`);
const content = t.rich(`intro.boxes.${key}.content`, {
italics: (chunks) => <em>{chunks}</em>,
});
return (
<Grid
className="margin-bottom-6"
key={title + "-key"}
tabletLg={{ col: 4 }}
>
<div className="border radius-md border-base-lighter padding-x-205">
<h3 className="tablet-lg:font-serif-lg">{title}</h3>
<p className="margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
{content}
</p>
</div>
</Grid>
);
})}
</Grid>
</ContentLayout>
);
};

export default ProcessIntro;
67 changes: 67 additions & 0 deletions frontend/src/app/[locale]/process/ProcessInvolved.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { ExternalRoutes } from "src/constants/routes";

import { useTranslations } from "next-intl";
import { Grid } from "@trussworks/react-uswds";

import ContentLayout from "src/components/ContentLayout";

const ProcessInvolved = () => {
const t = useTranslations("Process");

const email = ExternalRoutes.EMAIL_SIMPLERGRANTSGOV;
const para1 = t.rich("involved.paragraph_1", {
email: (chunks) => (
<a href={`mailto:${email}`} target="_blank" rel="noopener noreferrer">
{chunks}
</a>
),
strong: (chunks) => <strong> {chunks} </strong>,
});
const para2 = t.rich("involved.paragraph_2", {
github: (chunks) => (
<a
className="usa-link--external"
target="_blank"
rel="noopener noreferrer"
href={ExternalRoutes.GITHUB_REPO}
>
{chunks}
</a>
),
wiki: (chunks) => (
<a
className="usa-link--external"
target="_blank"
rel="noopener noreferrer"
href={ExternalRoutes.WIKI}
>
{chunks}
</a>
),
strong: (chunks) => <strong> {chunks} </strong>,
});
return (
<ContentLayout data-testid="process-involved-content" bottomBorder="none">
<Grid row gap="lg">
<Grid tabletLg={{ col: 6 }}>
<h3 className="tablet-lg:font-sans-lg tablet-lg:margin-bottom-05">
{t("involved.title_1")}
</h3>
<p className="font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
{para1}
</p>
</Grid>
<Grid tabletLg={{ col: 6 }}>
<h3 className="tablet-lg:font-sans-lg tablet-lg:margin-bottom-05">
{t("involved.title_2")}
</h3>
<p className="font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
{para2}
</p>
</Grid>
</Grid>
</ContentLayout>
);
};

export default ProcessInvolved;
Original file line number Diff line number Diff line change
@@ -1,38 +1,35 @@
import { ExternalRoutes } from "src/constants/routes";
import React from "react";

import { Trans, useTranslation } from "next-i18next";
import { useTranslations, useMessages } from "next-intl";
import Link from "next/link";
import {
Button,
Grid,
Icon,
IconList,
IconListContent,
IconListIcon,
IconListItem,
IconListTitle,
} from "@trussworks/react-uswds";
import { USWDSIcon } from "src/components/USWDSIcon";

import ContentLayout from "src/components/ContentLayout";

type Boxes = {
title: string;
content: string;
};

const ProcessMilestones = () => {
const { t } = useTranslation("common", { keyPrefix: "Process" });
const t = useTranslations("Process");

const iconList: Boxes[] = t("milestones.icon_list", { returnObjects: true });
const messages = useMessages() as unknown as IntlMessages;
const keys = Object.keys(messages.Process.milestones.icon_list);

const getIcon = (iconIndex: number) => {
switch (iconIndex) {
case 0:
return <Icon.Search aria-hidden={true} className="text-middle" />;
return <USWDSIcon className="usa-icon" name="search" />;
case 1:
return <Icon.Assessment aria-hidden={true} className="text-middle" />;
return <USWDSIcon className="usa-icon" name="assessment" />;
case 2:
return <Icon.ContentCopy aria-hidden={true} className="text-middle" />;
return <USWDSIcon className="usa-icon" name="content_copy" />;
default:
return <></>;
}
Expand All @@ -47,50 +44,55 @@ const ProcessMilestones = () => {
bottomBorder="dark"
gridGap={6}
>
{!Array.isArray(iconList)
? ""
: iconList.map((box, index) => {
return (
<Grid key={box.title + "-key"} tabletLg={{ col: 4 }}>
<IconList className="usa-icon-list--size-lg">
<IconListItem className="margin-top-4">
<IconListIcon>{getIcon(index)}</IconListIcon>
<IconListContent className="tablet-lg:padding-right-3 desktop-lg:padding-right-105">
<IconListTitle className="margin-bottom-2" type="h3">
{box.title}
</IconListTitle>
<Trans
t={t}
i18nKey={box.content}
components={{
p: (
<p className="font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6"></p>
),
chevron: (
<Icon.NavigateNext
className="display-none tablet-lg:display-block text-base-lighter position-absolute right-0 top-0 margin-right-neg-5"
size={9}
aria-label="launch"
/>
),
}}
{keys.map((key, index) => {
const title = t(`milestones.icon_list.${key}.title`);
const content = t.rich(`milestones.icon_list.${key}.content`, {
p: (chunks) => (
<p className="font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
{chunks}
</p>
),
italics: (chunks) => <em>{chunks}</em>,
});

return (
<Grid key={title + "-key"} tabletLg={{ col: 4 }}>
<IconList className="usa-icon-list--size-lg">
<IconListItem className="margin-top-4">
<IconListIcon>{getIcon(index)}</IconListIcon>
<IconListContent className="tablet-lg:padding-right-3 desktop-lg:padding-right-105">
<IconListTitle className="margin-bottom-2" type="h3">
{title}
</IconListTitle>
<div className="font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
{content}
</div>
{
// Don't show the chevron in the last row item.
index < keys.length - 1 ? (
<USWDSIcon
className="usa-icon usa-icon--size-9 display-none tablet-lg:display-block text-base-lighter position-absolute right-0 top-0 margin-right-neg-5"
name="navigate_next"
/>
</IconListContent>
</IconListItem>
</IconList>
</Grid>
);
})}
) : (
""
)
}
</IconListContent>
</IconListItem>
</IconList>
</Grid>
);
})}
</ContentLayout>
<ContentLayout
title={
<>
<small className="display-block font-sans-lg margin-bottom-105">
{t("milestones.roadmap_1")}
<Icon.NavigateNext
className="text-middle text-base-light"
size={4}
aria-label="launch"
<USWDSIcon
className="usa-icon usa-icon--size-4 text-middle text-base-light"
name="navigate_next"
/>
{t("milestones.title_1")}
</small>
Expand Down Expand Up @@ -120,10 +122,9 @@ const ProcessMilestones = () => {
<Link href={ExternalRoutes.MILESTONE_GET_OPPORTUNITIES} passHref>
<Button className="margin-bottom-4" type="button" size="big">
<span className="margin-right-5">{t("milestones.cta_1")}</span>
<Icon.Launch
className="text-middle margin-left-neg-4"
size={4}
aria-label="launch"
<USWDSIcon
name="launch"
className="usa-icon usa-icon--size-4 text-middle margin-left-neg-4"
/>
</Button>
</Link>
Expand All @@ -134,10 +135,9 @@ const ProcessMilestones = () => {
<>
<small className="display-block font-sans-lg margin-bottom-105">
{t("milestones.roadmap_2")}
<Icon.NavigateNext
className="text-middle text-base-light"
size={4}
aria-label="launch"
<USWDSIcon
className="usa-icon usa-icon--size-4 text-middle text-base-light"
name="navigate_next"
/>
{t("milestones.title_2")}
</small>
Expand All @@ -156,37 +156,14 @@ const ProcessMilestones = () => {
<h3 className="tablet-lg:font-sans-lg tablet-lg:margin-bottom-05">
{t("milestones.sub_title_3")}
</h3>
<p className="margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
<Trans
t={t}
i18nKey="milestones.sub_paragraph_3"
components={{
LinkToGrants: (
<a
target="_blank"
rel="noopener noreferrer"
href={ExternalRoutes.GRANTS_HOME}
/>
),
}}
/>
</p>
<p className="margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6">
<Trans
t={t}
i18nKey="milestones.sub_paragraph_4"
components={{
LinkToNewsletter: <Link href="/newsletter" />,
}}
/>
</p>
<p className="margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6"></p>
<p className="margin-top-0 font-sans-md line-height-sans-4 desktop-lg:line-height-sans-6"></p>
<Link href={ExternalRoutes.MILESTONE_SEARCH_MVP} passHref>
<Button className="margin-bottom-4" type="button" size="big">
<span className="margin-right-5">{t("milestones.cta_2")}</span>
<Icon.Launch
className="text-middle margin-left-neg-4"
size={4}
aria-label="launch"
<USWDSIcon
name="launch"
className="usa-icon usa-icon--size-4 text-middle margin-left-neg-4"
/>
</Button>
</Link>
Expand Down
38 changes: 38 additions & 0 deletions frontend/src/app/[locale]/process/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { PROCESS_CRUMBS } from "src/constants/breadcrumbs";

import BetaAlert from "src/components/BetaAlert";

import Breadcrumbs from "src/components/Breadcrumbs";
import PageSEO from "src/components/PageSEO";
import { Metadata } from "next";
import ProcessIntro from "src/app/[locale]/process/ProcessIntro";
import ProcessInvolved from "src/app/[locale]/process/ProcessInvolved";
import ProcessMilestones from "src/app/[locale]/process/ProcessMilestones";
import { useTranslations } from "next-intl";
import { getTranslations } from "next-intl/server";

export async function generateMetadata() {
const t = await getTranslations({ locale: "en" });
const meta: Metadata = {
title: t("Process.page_title"),
description: t("Process.meta_description"),
};
return meta;
}

export default function Process() {
const t = useTranslations("Process");

return (
<>
<PageSEO title={t("page_title")} description={t("meta_description")} />
<BetaAlert />
<Breadcrumbs breadcrumbList={PROCESS_CRUMBS} />
<ProcessIntro />
<div className="padding-top-4 bg-gray-5">
<ProcessMilestones />
</div>
<ProcessInvolved />
</>
);
}
Loading

0 comments on commit 32ba4ee

Please sign in to comment.