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

[ Issue 361 ] Funding Opportunity Content #377

Merged
merged 50 commits into from
Aug 18, 2023

Conversation

SammySteiner
Copy link
Contributor

@SammySteiner SammySteiner commented Aug 17, 2023

Summary

Fixes #361

Time to review: 15 min

Changes proposed

  • Added funding opportunity content to index page
  • Created pdf container component
  • created stories for funding opportunity content component and pdf container component
  • tests and test coverage for funding opportunity content component and pdf container component
  • Added custom css class with slight hover animation for pdfs

Context for reviewers

  • Ignored Feedback form per discussion with @andycochran
  • Discussed image breakpoints with @andycochran for pdfs to confirm 4 -> 2 -> 1 for different screen sizes
  • Discussed where images should be served with Andy and decided root/docs/pdf_file was the best user experience, though this may create some duplication with where the pdfs are currently stored
  • If/when pdfs are updated, if the front page or two are changed, we may need to update the images as well.
  • Had to add screen breakpoints to our theme to add tabletLg for the additional image breakpoint

Additional information

Screenshots, GIF demos, code examples or output to help show the changes working as expected.

Local test and coverage

image

index page desktop

image

index page mobile

image

storybook

image

@SammySteiner SammySteiner marked this pull request as ready for review August 17, 2023 16:26

const PdfContainer = ({ file, image, alt }: pdf) => {
return (
<Grid className="margin-bottom-2" tablet={{ col: 6 }} tabletLg={{ col: 3 }}>
Copy link
Collaborator

@andycochran andycochran Aug 17, 2023

Choose a reason for hiding this comment

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

nit: PdfContainer seems like the wrong name. It doesn't contain any PDFs. It links to PDFs, but technically that doesn't even have to be the case; you could pass it whatever link (file doesn't even have to be a file). Functionally this component is more of an "image link." You might even move this grid element into the nofoPdfs.map in the funding content and let this component just worry about making image links.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense to me. I renamed it NofoImageLInk.

"widescreen": false,
// 1400px
),

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the formatter moving these inline comments to their own line? I find this much easier to read:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that was the formatter.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Might be a setting that allows inline CSS comments. 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

What is this doing? Are we overriding the defaults?

Copy link
Collaborator

Choose a reason for hiding this comment

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

By default only mobile-lg, tablet, and desktop breakpoints are enabled. This PR overrides the breakpoint map to also enable tablet-lg.

Copy link
Collaborator

Choose a reason for hiding this comment

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

…so that we can have all 4 PDF links beside each other on screens slightly smaller than desktop. Otherwise the link images are HUGE.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Seems like prettier is super opinionated on not having comments on the same line as code, so much so that there is no option to disable it for a file, and for some reason, // prettier-ignore ir /* prettier-ignore */ isn't working on this block of scss code: prettier/prettier#807

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe we don't need the inline comments.

  /* Override default breakpoints, 
     see https://designsystem.digital.gov/utilities/layout-grid/#utilities-settings */ 
  $theme-utility-breakpoints: (
    "card": false,
    "card-lg": false,
    "mobile": false,
    "mobile-lg": true,
    "tablet": true,
    "tablet-lg": true,
    "desktop": true,
    "desktop-lg": false,
    "widescreen": false,
   ),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

kk, let's go with that.

const { t } = useTranslation("common", { keyPrefix: "Index" });

return (
<div className="bg-base-lightest">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we add some dynamic top/bottom padding to this section? LIke what @daphnegold did on the hero section:

  className="bg-primary desktop:padding-y-15 tablet:padding-y-2 padding-y-1"

Not as much as "15" but this same technique.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good, I added className="desktop:padding-y-4 tablet:padding-y-2 padding-y-1" to both the funding and goal content sections.

Copy link
Contributor

Choose a reason for hiding this comment

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

There are a lot of additional packages in here, is that intentional or maybe a remnant of react-pdf?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that must have been a hold over from the react-pdf experimentation. Thanks for catching.

<h3>{t("fo_title_2")}</h3>
</Grid>
<Grid>
<p className="usa-intro">{t("fo_paragraph_3")}</p>
Copy link
Contributor

@daphnegold daphnegold Aug 17, 2023

Choose a reason for hiding this comment

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

I noticed this in the Goal Content component too, that the fonts are kinda wonky and we're swapping between serif and sans. Just an observation we may want to address now or in the future.

The cause according to testing locally is the usa-intro class. I'm guessing in some cases it applies a different font palette that overrides our current one? Not entirely sure, should we remove?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Once we have the whole page together, I'll take a pass at tidying up any typography and whitespace issues. Within the context of a responsive layout, I'll be able to better specify optimal size/padding/etc. (That's harder and more tedious to do in Figma unless you make like 5 versions of the page at various widths.)

Copy link
Collaborator

Choose a reason for hiding this comment

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

(In Figma, I failed to represent the .usa-intro content with the right serif font. Not a problem that this doesn't match what's in Figma.)

Copy link
Contributor

@daphnegold daphnegold left a comment

Choose a reason for hiding this comment

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

Only thing I'd request is to make sure the package-lock.json is reflecting reality because there's a lot of new stuff in there, possibly erroneously

"widescreen": false,
// 1400px
),

Copy link
Contributor

Choose a reason for hiding this comment

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

What is this doing? Are we overriding the defaults?

@@ -37,7 +37,7 @@ describe("Index", () => {

it("passes accessibility scan", async () => {
const { container } = render(<Index />);
const results = await axe(container);
const results = await waitFor(() => axe(container));
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious why this was added for my own knowledge :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we're using the next/link Link component, that returns a promise, I think, so without the waitFor, the axe was not able to see the entire page. As a result it logged a bunch of warnings.

<p className="usa-intro">{t("fo_paragraph_3")}</p>
</Grid>
<Grid row gap>
{nofoPdfs.map((pdf) => (
Copy link
Contributor

Choose a reason for hiding this comment

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

I love the way you didn't hardcode these in here and we can swap them out! 🥇

@SammySteiner SammySteiner merged commit e29f05e into main Aug 18, 2023
@SammySteiner SammySteiner deleted the sammysteiner/issue-361-fo-content branch August 18, 2023 15:04
@sumiat sumiat mentioned this pull request Aug 29, 2023
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Implement the funding opportunity section for the static site
4 participants