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

Updated hero of main page #51

Merged
merged 6 commits into from
Nov 19, 2024
Merged
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
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
},
"cSpell.words": ["USWDS"]
}
Binary file added public/images/homepage-hero-bg.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions src/app/components/Header/Header.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,42 @@
font-size: 13px;
}
}

.homepage-hero {
position: relative;
overflow: hidden;

&::before {
content: '';
position: absolute;
top: -20%;
left: -10%;
right: -10%;
bottom: 0;
background: linear-gradient(
90deg,
rgba(76, 43, 100, 0.85) 12%,
rgba(0, 94, 162, 0.85) 50%,
rgba(0, 129, 161, 0.85) 98%
),
url('/images/homepage-hero-bg.jpeg');
background-size: cover;
background-position: center 40%;
transform: scale(1.2);
z-index: 0;
}

.usa-nav-container,
.usa-header,
.usa-logo,
.usa-navbar {
position: relative;
z-index: 1;
}
nickbristow marked this conversation as resolved.
Show resolved Hide resolved
section h1,
section p {
position: relative;
nickbristow marked this conversation as resolved.
Show resolved Hide resolved
z-index: 1;
color: white !important;
nickbristow marked this conversation as resolved.
Show resolved Hide resolved
}
}
39 changes: 37 additions & 2 deletions src/app/components/Header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,33 @@ import classNames from 'classnames';
import { basePath } from '../../utils/constants';
import { NavigationLink } from '../NavigationLink/NavigationLink';
import styles from './Header.module.scss';
import Hero from '../Hero/Hero';
import { usePathname } from 'next/navigation';

export default function Header() {
interface HeroContent {
heroClass?: string;
heroHeader: string;
heroSubheader: string;
}

type SpecialContent = {
[key: string]: HeroContent;
};
nickbristow marked this conversation as resolved.
Show resolved Hide resolved

const specialContent: SpecialContent = {
'/': {
heroClass: 'homepage-hero',
heroHeader: `Improve the way your jurisdiction collects, processes, and
views public health data`,
heroSubheader: `Turn your jurisdiction's data into meaningful intelligence that drives
timely public health action using CDC's free, cloud-based products built
from Data Integration Building Blocks, or DIBBs.`,
},
};
nickbristow marked this conversation as resolved.
Show resolved Hide resolved
const pathname = usePathname();
const customContent = specialContent[pathname];

const [expanded, setExpanded] = React.useState(false);
const onClick = () => {
if (window.innerWidth < 1024) setExpanded((prvExpanded) => !prvExpanded);
Expand All @@ -26,7 +51,11 @@ export default function Header() {
];

return (
<>
<div
className={
customContent?.heroClass ? styles[customContent.heroClass] : ''
}
>
<a className="usa-skipnav" href="#main-content">
Skip to main content
</a>
Expand Down Expand Up @@ -63,6 +92,12 @@ export default function Header() {
/>
</div>
</USWDSHeader>
</>
{customContent && (
nickbristow marked this conversation as resolved.
Show resolved Hide resolved
<Hero
header={customContent.heroHeader}
subheader={customContent.heroSubheader}
/>
)}
</div>
);
}
6 changes: 0 additions & 6 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { Grid, GridContainer } from '@trussworks/react-uswds';
import Image from 'next/image';
import { basePath } from './utils/constants';
import Carousel from './components/Carousel/Carousel';
import Hero from './components/Hero/Hero';
import { ContentContainer } from './components/ContentContainer/ContentContainer';
import { LinkButton } from './components/LinkButton/LinkButton';

Expand Down Expand Up @@ -49,11 +48,6 @@ const homeContent = {
export default async function Home() {
return (
<>
<Hero
header={homeContent.hero.header}
subheader={homeContent.hero.subheader}
/>

<DibbsSection />
<ValueSection />
<JurisdictionSection />
Expand Down
Loading