-
Notifications
You must be signed in to change notification settings - Fork 81
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 SummaryBox #1098
Conversation
…g, render passed in text as children
…n each anchor tag, disable eslint anchor validity check in both files
… props to its own obj and pass into the test
…book example, add test checking for rendering children
…rks/react-uswds into ak-new-component-summary-box-988
import { SummaryBox } from './SummaryBox' | ||
|
||
export default { | ||
title: 'Components/SummaryBox', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: can we name this Components / Summary box
so it matches the USWDS name?
yarn.lock
Outdated
>>>>>>> main | ||
======= | ||
|
||
>>>>>>> fc36dbd77f8c8665eb25297a28c56e1fd6b4a7ff |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These merge conflicts need to be resolved
} | ||
|
||
const summaryBoxContent = ( | ||
<div className="usa-summary-box__text"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this <div className="usa-summary-box__text">
is repeated in the Story (since it's also rendered in the component itself) - can we remove?
…rks/react-uswds into ak-new-component-summary-box-988
## [1.17.0](1.16.0...1.17.0) (2021-05-05) ### Features * Checkbox Tile Variant ([#1104](#1104)) ([9936c4a](9936c4a)) * Implement ProcessListHeading subcomponent ([#1162](#1162)) ([964e34c](964e34c)) * New Component ProcessList MVP ([#1107](#1107)) ([1bc0f93](1bc0f93)) * New Component SiteAlert ([#1099](#1099)) ([c1e88e0](c1e88e0)) * New Component SummaryBox ([#1098](#1098)) ([b2279b4](b2279b4)) * Radio Button Tile Variant ([#1101](#1101)) ([a2f40a0](a2f40a0)) * Update Grid components to render any type of element ([#1166](#1166)) ([07468c8](07468c8)), closes [#1194](#1194) * Update Search component to support i18n ([#1192](#1192)) ([5241d15](5241d15)) * Update Table to 2.10.0 implementation ([#1110](#1110)) ([117a6c7](117a6c7))
* Create skeleton for new component SummaryBox, render passed in heading, render passed in text as children * Add default Storybook example * Add test for ability to pass props * Remove empty comment * Make Storybook example variable name lower case * Commit yarn.lock changes * Remove unwanted spaces from Storybook example * Remove everything except '#' from the test and Storybook href props in each anchor tag, disable eslint anchor validity check in both files * Remove hardcoded role prop from SummaryBox root div, move test custom props to its own obj and pass into the test * Remove unnecessary data-testid, separate summary box content in storybook example, add test checking for rendering children * Export SummaryBox from index.ts * Remove straggler - extended href name * Move enclosing div from Storybook to SummaryBox component wrapping children, make the props passed to the root div more explicitly named divProps * Add check for passing custom classname * Update stories file as per Suz's PR feedback * Resolve conflicts in yarn.lock * Regenerate yarn.lock * Remove unnecessary spaces from default export in Storybook
## [1.17.0](1.16.0...1.17.0) (2021-05-05) ### Features * Checkbox Tile Variant ([#1104](#1104)) ([9936c4a](9936c4a)) * Implement ProcessListHeading subcomponent ([#1162](#1162)) ([964e34c](964e34c)) * New Component ProcessList MVP ([#1107](#1107)) ([1bc0f93](1bc0f93)) * New Component SiteAlert ([#1099](#1099)) ([c1e88e0](c1e88e0)) * New Component SummaryBox ([#1098](#1098)) ([b2279b4](b2279b4)) * Radio Button Tile Variant ([#1101](#1101)) ([a2f40a0](a2f40a0)) * Update Grid components to render any type of element ([#1166](#1166)) ([07468c8](07468c8)), closes [#1194](#1194) * Update Search component to support i18n ([#1192](#1192)) ([5241d15](5241d15)) * Update Table to 2.10.0 implementation ([#1110](#1110)) ([117a6c7](117a6c7))
Summary
This PR adds the USWDS SummaryBox component.
Related Issues or PRs
closes #988
I took a different approach than the story outlined, as suggested by Hana, that prioritizes flexibility for the user over providing more structure.
If in the future we wish to constrain the component further, we could extend this component using the proposed implementation from the issue. To do so, we would add the
<ul>
into SummaryBox, and create two subcomponents that would provide the rest of the skeleton for the list items and links;SummaryBoxInfoItem
with a<li>
root element, andSummaryBoxLink
which could be implemented using the existing<Link asCustom />
component, following the pattern inBreadcrumbLink
andIdentifierLink
.How To Test
Check out this branch and run
yarn test
to execute tests andyarn storybook
to see the new component in action.Alternatively, you can scroll to the bottom of this page and click "Show environments" on the right above the comment input box.
Screenshots