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

feat: New Component: Step indicator #952

Merged
merged 17 commits into from
Mar 5, 2021
Merged

Conversation

brandonlenz
Copy link
Contributor

@brandonlenz brandonlenz commented Feb 22, 2021

Summary

Adds new Step Indicator Component.

Related Issues or PRs

closes: #487

Notes

  • Localization/Internationalization: I do not currently have localizations pushed for the screenreader text or the of in "3 of 5", for example. There are several different ways I can think of to handle this:
  • Edit: Looks like uswds is considering options Use localized data for interactive components uswds/uswds#3445
  • We could pass in a map of localizations as an optional prop to any components that could accept custom verbiage:
interface StepIndicatorLocalizations {
  STEP: string
  OF: string
  
}

interface StepIndicatorProps {
  {...}
  localizations?: StepIndicatorLocalizations
}

interface StepIndicatorStepLocalizations {
  COMPLETED: string
  NOT_COMPLETED: string
}

interface StepIndicatorStepProps {
  {...}
  localizations?: StepIndicatorStepLocalizations
}
  • We could also work with a more "react-y" solution using useContext for localizations at the App level.
  • This may deserve a larger discussion and github issue (I'll file one if one does not already exist) to decide on the right solution.

How To Test

Checkout bl-step-indicator-487 and run storybook to inspect the component variations further

Screenshots (optional)

Default

image


No Labels

image


Centered Labels

image


Counters

image


Small Counters

image

@brandonlenz brandonlenz added this to the USWDS 2.9.0 milestone Feb 22, 2021
@brandonlenz brandonlenz added the status: wip Work in progress - not ready for code review label Feb 22, 2021
<span className="usa-step-indicator__current-step">
{currentStepNumber}
</span>
&nbsp;
Copy link
Contributor Author

@brandonlenz brandonlenz Feb 23, 2021

Choose a reason for hiding this comment

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

If you noticed this &nbsp; being present here but not in the uswds source code, I can add some context:

In the uswds examples, there are spaces as shown in the image below:
image

The spaces after the circled step number and after the total number of steps come from implicit spacing added between html inline elements (so long as the html elements are separated by newlines)

Since rendered react html is minified, the implicit spacing is not rendered, so I had to explicitly add spaces here.

I may raise an issue with uswds. While this is not a quirky bug with a single browser, they may want to know about an inconsistency in display of one of their components when code is minified vs non-minified, similar to uswds/uswds#3997.

@brandonlenz brandonlenz marked this pull request as ready for review February 23, 2021 15:56
@brandonlenz brandonlenz removed the status: wip Work in progress - not ready for code review label Feb 24, 2021
@haworku
Copy link
Contributor

haworku commented Feb 26, 2021

This may deserve a larger discussion and github issue (I'll file one if one does not already exist) to decide on the right solution.

Let's definitely make an issue. I like the idea of starting a pattern for localizations 🌟 . And also things like "step X of X" are usually complicated (you don't want to translate a sentence or phrase word by word for i1n because that assumes certain grammar structure). We might want to throw around more ideas with that or decide its out of scope.

Copy link
Contributor

@haworku haworku left a comment

Choose a reason for hiding this comment

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

Ready to approve this just would like to get your 👀 on the counters type again

@brandonlenz brandonlenz requested a review from haworku March 5, 2021 22:09
@brandonlenz brandonlenz merged commit 5968c8d into uswds-2.9.0 Mar 5, 2021
@brandonlenz brandonlenz deleted the bl-step-indicator-487 branch March 5, 2021 23:07
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.

2 participants