-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use context for header * remove is ready * fix build error * Erase header content if not path * update name of heroWrapper
- Loading branch information
1 parent
d52837a
commit a6088fd
Showing
9 changed files
with
167 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use client'; | ||
|
||
import { createContext, useState, useContext } from 'react'; | ||
import { usePathname } from 'next/navigation'; | ||
import { homePageHero } from '../data/home'; | ||
|
||
interface HeroContent { | ||
heroContent: { | ||
header: string; | ||
subheader: string; | ||
heroClass: string; | ||
pathname: string; | ||
}; | ||
setHeroContent: (content: { | ||
header: string; | ||
subheader: string; | ||
heroClass: string; | ||
pathname: string; | ||
}) => void; | ||
} | ||
|
||
const HeroContext = createContext<HeroContent>({ | ||
heroContent: { | ||
header: '', | ||
subheader: '', | ||
heroClass: '', | ||
pathname: '', | ||
}, | ||
setHeroContent: () => {}, | ||
}); | ||
|
||
export function HeroContextProvider({ | ||
children, | ||
}: Readonly<{ | ||
children: React.ReactNode; | ||
}>) { | ||
const pathname = usePathname(); | ||
const isHome = pathname === '/'; | ||
const [heroContent, setHeroContent] = useState( | ||
isHome | ||
? homePageHero | ||
: { | ||
header: '', | ||
subheader: '', | ||
heroClass: '', | ||
pathname: '', | ||
}, | ||
); | ||
|
||
return ( | ||
<HeroContext.Provider value={{ heroContent, setHeroContent }}> | ||
{children} | ||
</HeroContext.Provider> | ||
); | ||
} | ||
|
||
export function useHeroContext() { | ||
return useContext(HeroContext); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export const homeContent = { | ||
dibbs: { | ||
title: 'Introducing Data Integration Building Blocks', | ||
description: | ||
'DIBBs are modular, open-source software that can be configured to clean, transform, and enrich data. We build cloud-enabled products that leverage DIBBs to provide the following benefits to public health jurisdictions:', | ||
benefits: [ | ||
'Better, higher quality data for use in data analysis', | ||
'Time-savings for public health staff thanks to reduced manual work', | ||
'More usable data that makes case investigation easier', | ||
'Automated data processing that streamlines data workflows', | ||
'Flexible cloud deployment options, including free central hosting through CDC', | ||
], | ||
}, | ||
valueSection: { | ||
title: "Unlock the value of your jurisdiction's data", | ||
description: | ||
'DIBBs products help jurisdictions make the most of their data. From improving the usability of electronic case reporting (eCR) data to streamlining data collection from healthcare providers without the need for a direct connection, our products save jurisdictions time and effort for case investigation and analysis.', | ||
ctaText: 'Find out more about our products', | ||
ctaHref: '/products', | ||
}, | ||
jurisdictions: { | ||
title: 'Jurisdictions working with DIBBs', | ||
description: | ||
'State and local public health jurisdictions across the United States used DIBBs to solve their toughest data challenges', | ||
}, | ||
cta: { | ||
title: 'Interested in getting started with DIBBs?', | ||
description: | ||
'Contact our team to learn more about how our products can help improve your data workflows', | ||
ctaText: 'Engage with us', | ||
ctaHref: '/engage-with-us', | ||
}, | ||
}; | ||
|
||
export const homePageHero = { | ||
header: | ||
'Improve the way your jurisdiction collects, processes, and views public health data', | ||
subheader: | ||
"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.", | ||
heroClass: 'homepage-hero', | ||
pathname: '/', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use client'; | ||
import { useEffect } from 'react'; | ||
import { useHeroContext } from '../context'; | ||
import { usePathname } from 'next/navigation'; | ||
|
||
interface HeroInitProps { | ||
header: string; | ||
subheader: string; | ||
heroClass: string; | ||
} | ||
|
||
export function useHeroInit({ header, subheader, heroClass }: HeroInitProps) { | ||
const { setHeroContent } = useHeroContext(); | ||
const pathname = usePathname(); | ||
useEffect(() => { | ||
setHeroContent({ | ||
header, | ||
subheader, | ||
heroClass, | ||
pathname, | ||
}); | ||
}, [setHeroContent, header, subheader, heroClass]); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters