Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: max width layout #4500

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions sites/public/src/layouts/max-width.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.layout-max-width-container {
margin-block: var(--seeds-s6);
padding-inline: var(--seeds-s4);

@media (--md-and-up) {
margin-block: var(--seeds-s12);
}

p:not(:last-child) {
margin-block-end: var(--seeds-s4);
}
}

.layout-max-width-content {
max-width: var(--seeds-screen-lg);
margin: auto;
}
15 changes: 15 additions & 0 deletions sites/public/src/layouts/max-width.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react"
import styles from "./max-width.module.scss"

interface FormLayoutProps {
children: React.ReactNode
}
const MaxWidthLayout = (props: FormLayoutProps) => {
return (
<div className={styles["layout-max-width-container"]}>
<div className={styles["layout-max-width-content"]}>{props.children}</div>
</div>
)
}

export default MaxWidthLayout
7 changes: 4 additions & 3 deletions sites/public/src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React, { useEffect, useContext } from "react"
import Layout from "../layouts/application"
import Head from "next/head"
import { Hero, MarkdownSection, t } from "@bloom-housing/ui-components"
import { Hero, t } from "@bloom-housing/ui-components"
import { PageView, pushGtmEvent, AuthContext } from "@bloom-housing/shared-helpers"
import { Button } from "@bloom-housing/ui-seeds"
import { UserStatus } from "../lib/constants"
import MaxWidthLayout from "../layouts/max-width"

const ErrorPage = () => {
const pageTitle = t("errors.notFound.title")
Expand All @@ -28,14 +29,14 @@ const ErrorPage = () => {
{t("errors.notFound.message")}
</Hero>
<div className="homepage-extra">
<MarkdownSection fullwidth={true}>
<MaxWidthLayout>
<>
<p>{t("welcome.seeMoreOpportunities")}</p>
<Button variant="primary-outlined" href="/additional-resources">
{t("welcome.viewAdditionalHousing")}
</Button>
</>
</MarkdownSection>
</MaxWidthLayout>
</div>
</Layout>
)
Expand Down
16 changes: 6 additions & 10 deletions sites/public/src/pages/_error.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React, { useEffect, useContext } from "react"
import Layout from "../layouts/application"
import Head from "next/head"
import { Hero, MarkdownSection, t } from "@bloom-housing/ui-components"
import { Hero, t } from "@bloom-housing/ui-components"
import { PageView, pushGtmEvent, AuthContext } from "@bloom-housing/shared-helpers"
import { Button } from "@bloom-housing/ui-seeds"
import { UserStatus } from "../lib/constants"
import MaxWidthLayout from "../layouts/max-width"

const ErrorPage = () => {
const pageTitle = t("errors.notFound.title")
Expand All @@ -20,24 +19,21 @@ const ErrorPage = () => {
}, [profile])

return (
<Layout>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this page was rendering (when the listing call fails on the listing view page) the header and footer were actually rendering twice.

<Head>
<title>{pageTitle}</title>
</Head>
<>
<Hero title={pageTitle} buttonTitle={t("welcome.seeRentalListings")} buttonLink="/listings">
{t("errors.notFound.message")}
</Hero>
<div className="homepage-extra">
<MarkdownSection fullwidth={true}>
<MaxWidthLayout>
<>
<p>{t("welcome.seeMoreOpportunities")}</p>
<Button variant="primary-outlined" href="/additional-resources">
{t("welcome.viewAdditionalHousing")}
</Button>
</>
</MarkdownSection>
</MaxWidthLayout>
</div>
</Layout>
</>
)
}

Expand Down