-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ Issue 361 ] Funding Opportunity Content (#377)
* Created stories and tests * Created NofoImageLink component * Added TabletLg breakpoint --------- Co-authored-by: Daphne Gold <[email protected]> Co-authored-by: Andy Cochran <[email protected]>
- Loading branch information
1 parent
b7af633
commit e29f05e
Showing
23 changed files
with
229 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,56 @@ | ||
import { nofoPdfs } from "src/constants/nofoPdfs"; | ||
|
||
import { useTranslation } from "next-i18next"; | ||
import { Grid, GridContainer } from "@trussworks/react-uswds"; | ||
|
||
import NofoImageLink from "./NofoImageLink"; | ||
|
||
const FundingContent = () => { | ||
const { t } = useTranslation("common", { keyPrefix: "Index" }); | ||
|
||
return ( | ||
<div className="bg-base-lightest desktop:padding-y-4 tablet:padding-y-2 padding-y-1"> | ||
<GridContainer> | ||
<Grid row> | ||
<h2 className="margin-bottom-0">{t("fo_title")}</h2> | ||
</Grid> | ||
<Grid row gap="md"> | ||
<Grid tablet={{ col: 6 }}> | ||
<p>{t("fo_paragraph_1")}</p> | ||
</Grid> | ||
<Grid tablet={{ col: 6 }}> | ||
<p>{t("fo_paragraph_2")}</p> | ||
</Grid> | ||
</Grid> | ||
<Grid> | ||
<h3>{t("fo_title_2")}</h3> | ||
</Grid> | ||
<Grid> | ||
<p className="usa-intro">{t("fo_paragraph_3")}</p> | ||
</Grid> | ||
<Grid row gap> | ||
{nofoPdfs.map((pdf) => ( | ||
<NofoImageLink | ||
key={pdf.file} | ||
file={pdf.file} | ||
image={pdf.image} | ||
alt={t(`${pdf.alt}`)} | ||
/> | ||
))} | ||
</Grid> | ||
<Grid row gap="md"> | ||
<Grid tablet={{ col: 6 }}> | ||
<h2>{t("fo_title_3")}</h2> | ||
<p className="usa-intro">{t("fo_paragraph_4")}</p> | ||
</Grid> | ||
<Grid tablet={{ col: 6 }}> | ||
<h3>{t("fo_title_4")}</h3> | ||
<p>{t("fo_paragraph_5")}</p> | ||
</Grid> | ||
</Grid> | ||
</GridContainer> | ||
</div> | ||
); | ||
}; | ||
|
||
export default FundingContent; |
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,28 @@ | ||
import { pdf } from "src/constants/nofoPdfs"; | ||
|
||
import Image from "next/image"; | ||
import Link from "next/link"; | ||
import { Grid } from "@trussworks/react-uswds"; | ||
|
||
const NofoImageLink = ({ file, image, alt }: pdf) => { | ||
return ( | ||
<Grid className="margin-bottom-2" tablet={{ col: 6 }} tabletLg={{ col: 3 }}> | ||
<Link className="padding-0" href={file} target="_blank"> | ||
<Image | ||
alt={alt} | ||
className="pdf-card" | ||
src={image} | ||
height={1290} | ||
width={980} | ||
style={{ | ||
width: "100%", | ||
height: "auto", | ||
}} | ||
sizes="(max-width: 640px) 100vw, (max-width: 880px) 50vw, 25vw" | ||
/> | ||
</Link> | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default NofoImageLink; |
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,28 @@ | ||
export type pdf = { | ||
file: string; // path to file in public directory | ||
image: string; // path to image in public directory | ||
alt: string; // key for translation in i18n json file | ||
}; | ||
|
||
export const nofoPdfs: pdf[] = [ | ||
{ | ||
file: "/docs/acl_prototype.pdf", | ||
image: "/img/acl_prototype.png", | ||
alt: "acl_prototype", | ||
}, | ||
{ | ||
file: "/docs/acf_prototype.pdf", | ||
image: "/img/acf_prototype.png", | ||
alt: "acf_prototype", | ||
}, | ||
{ | ||
file: "/docs/cdc_prototype.pdf", | ||
image: "/img/cdc_prototype.png", | ||
alt: "cdc_prototype", | ||
}, | ||
{ | ||
file: "/docs/samhsa_prototype.pdf", | ||
image: "/img/samhsa_prototype.png", | ||
alt: "samhsa_prototype", | ||
}, | ||
]; |
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 |
---|---|---|
|
@@ -21,3 +21,10 @@ i.e. | |
*/ | ||
|
||
@use "uswds-core" as *; | ||
|
||
.pdf-card { | ||
transition: transform 0.2s; | ||
&:hover { | ||
transform: scale(1.04); | ||
} | ||
} |
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,18 @@ | ||
import { Meta } from "@storybook/react"; | ||
|
||
import FundingContent from "src/components/FundingContent"; | ||
|
||
const meta: Meta<typeof FundingContent> = { | ||
title: "Components/Content/Funding Content", | ||
component: FundingContent, | ||
}; | ||
export default meta; | ||
|
||
export const Default = { | ||
parameters: { | ||
design: { | ||
type: "figma", | ||
url: "https://www.figma.com/file/lpKPdyTyLJB5JArxhGjJnE/beta.grants.gov?type=design&node-id=14-907&mode=design&t=gEXdEnzZUfuODXut-4", | ||
}, | ||
}, | ||
}; |
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,24 @@ | ||
import { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import NofoImageLink from "src/components/NofoImageLink"; | ||
|
||
const meta: Meta<typeof NofoImageLink> = { | ||
title: "Components/Nofo Image Link", | ||
component: NofoImageLink, | ||
}; | ||
export default meta; | ||
type Story = StoryObj<typeof NofoImageLink>; | ||
|
||
export const Primary: Story = { | ||
parameters: { | ||
design: { | ||
type: "figma", | ||
url: "https://www.figma.com/file/lpKPdyTyLJB5JArxhGjJnE/beta.grants.gov?type=design&node-id=86-600&mode=design&t=gEXdEnzZUfuODXut-4", | ||
}, | ||
}, | ||
args: { | ||
file: "/docs/acl_prototype.pdf", | ||
image: "/img/acl_prototype.png", | ||
alt: "This should be a key in i18n", | ||
}, | ||
}; |
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,15 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
import FundingContent from "src/components/FundingContent"; | ||
|
||
describe("Funding Content", () => { | ||
it("Renders without errors", () => { | ||
render(<FundingContent />); | ||
const fundingH2 = screen.getByRole("heading", { | ||
level: 2, | ||
name: /Improvements to funding opportunity announcements?/i, | ||
}); | ||
|
||
expect(fundingH2).toBeInTheDocument(); | ||
}); | ||
}); |
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,17 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
|
||
import NofoImageLink from "src/components/NofoImageLink"; | ||
|
||
describe("PdfContainer", () => { | ||
it("Renders without errors", () => { | ||
render( | ||
<NofoImageLink | ||
file="/test/file.pdf" | ||
image="/test/image.png" | ||
alt="test alt content" | ||
/> | ||
); | ||
const alt = screen.getByAltText("test alt content"); | ||
expect(alt).toBeInTheDocument(); | ||
}); | ||
}); |
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