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: Refactor page header to use USWDS components #1247

Merged
merged 89 commits into from
Dec 9, 2024

Conversation

sandrahoang686
Copy link
Collaborator

@sandrahoang686 sandrahoang686 commented Nov 7, 2024

Related Ticket: Close #1137
Related PR: NextJs PR developmentseed/next-veda-ui#20

Description of Changes

This change implements the page header with the USWDS ui components

Notes & Questions About Changes

The new header will have some design inconsistencies with the rest of the page, but that is intentional as we go through the revamp of the ui.

Validation / Testing

  • Validate the header contents
  • Use the navigation to access different pages
  • Use keyboard navigation, making sure the navigation is accessible
  • Instances can use the header and customize its content
    - [x] logo
    - [x] heading
    - [x] primary nav items
    - [x] secondary nav items

Copy link

netlify bot commented Nov 7, 2024

Deploy Preview for veda-ui ready!

Name Link
🔨 Latest commit 3c85467
🔍 Latest deploy log https://app.netlify.com/sites/veda-ui/deploys/67564b923422f40008f696f6
😎 Deploy Preview https://deploy-preview-1247--veda-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@AliceR AliceR changed the title 1137 implement new ds page header Reactor page header to use USWDS components Nov 11, 2024
@sandrahoang686 sandrahoang686 changed the title Reactor page header to use USWDS components Refactor page header to use USWDS components Nov 12, 2024
sandrahoang686 and others added 27 commits November 19, 2024 09:15
@use is for importing and using styles within the current file, while @forward is for re-exporting styles to make them available to other files that import the current file.

I am still not sure, how to decide when to use @use and when to use @forward in this project. The design system documentation only mentions @forward, so I am going with this.
I was not able to set up the formatting to be run via the eslint extension, so I use the prettier extension for scss files - see settings.json.sample for a suggestion on how to configure the vscode workspace
this requires more refactoring, to use only USWDS eventually
the refactored uswds header now lives in a separate directory
as the sliding header did not properly work with the USWDS components
not sure why the inline comment was ending up in the variable as part of the string, but a separate line for the comment fixed it
Starting with the nav dropdown button
make other dropdowns close on toggle
not sure about this... feels even more confusing.
wip, the test does not run yet...
Copy link

@faustoperez faustoperez left a comment

Choose a reason for hiding this comment

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

Looking good!

<React.Fragment key={item.id}>
{item.actionId === 'open-google-form' && (
<>
<a className='usa-nav__link' id={item.id}>
Copy link
Collaborator

@hanbyul-here hanbyul-here Dec 4, 2024

Choose a reason for hiding this comment

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

without href, a tag doesn't get keyboard focus (And its hover style doesn't show the cursor.) Can we give some dummy href to this a tag (or give a tabindex, mark the a tag as a button (role="button") and move the onclick event to a tag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

good callout, this should actually be a button since its a CTA. Now works as expected, when tabbing to CTA and clicking enter it opens modal.

}

.usa-nav__secondary-item .usa-nav__link {
padding: 0;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought uswds has enough utility classes that we don't need these individual styles for each item - https://designsystem.digital.gov/utilities/margin-and-padding/ any reason not using these utility classes?

Copy link
Collaborator Author

@sandrahoang686 sandrahoang686 Dec 4, 2024

Choose a reason for hiding this comment

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

yeah, if you are talking about doing something like ...

        <USWDSExtendedNav
          primaryItems={primaryItems}
          secondaryItems={secondaryItems}
          mobileExpanded={expanded}
          onToggleMobileNav={toggleExpansion}
          className='padding-0'
        />

unfortunately it doesn't work because this component has nested elements and this wants to just target the secondary nav items, not the primary. If you know how to or mean something else though, please suggest! Otherwise this follows this pattern more closely.

@sandrahoang686 sandrahoang686 changed the title Refactor page header to use USWDS components refactor: Refactor page header to use USWDS components Dec 9, 2024
@sandrahoang686 sandrahoang686 merged commit 50b507c into main Dec 9, 2024
10 of 11 checks passed
@sandrahoang686 sandrahoang686 deleted the 1137-implement-new-ds-page-header branch December 9, 2024 01:51
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.

[Refactor] Implement updated Page header / nav
6 participants