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!: Make Summary Box more flexible #1929

Merged
merged 22 commits into from
Apr 21, 2022
Merged

Conversation

hgarfinkle
Copy link
Contributor

@hgarfinkle hgarfinkle commented Mar 24, 2022

⚠️ Set the following as the commit body when merging this PR: BREAKING CHANGE: SummaryBox now exposes sub-components (SummaryBoxHeading and SummaryBoxContent) for a more compositional API. Consumers will need to update their implementation to match.

Summary

Makes the SummaryBox component more flexible, separating out SummaryBoxHeading and SummaryBoxHeading into their own components.
Is NOT backwards compatible.

Related Issues or PRs

Closes #1916

How To Test

Try the SummaryBox Storybook story to ensure it still displays properly

Screenshots (optional)

@hgarfinkle hgarfinkle changed the title Make Summary Box more flexible feat: Make Summary Box more flexible Mar 24, 2022
Isaac Garfinkle added 2 commits March 23, 2022 17:48
@kimallen kimallen changed the title feat: Make Summary Box more flexible !feat: Make Summary Box more flexible Mar 24, 2022
@kimallen kimallen changed the title !feat: Make Summary Box more flexible feat!: Make Summary Box more flexible Mar 24, 2022
@kimallen
Copy link
Contributor

I'm wondering if it would be worth breaking out the headingLevel change into its own issue/PR from the breaking change so that the headingLevel flexibility can be incorporated as a minor non-breaking change before the breaking change.

Copy link
Contributor

@brandonlenz brandonlenz left a comment

Choose a reason for hiding this comment

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

@Igarfinkle thanks so much for picking this up!

A couple of suggestions and one question to some other maintainers in my review here.

One nit: We don't seem to have a unified pattern for how we name folders when double nesting things, (e.g. in this case SummaryBox/SummaryBox, or Footer/Footer or card/Card). JS, React, and TS are pretty unopinionated about this, so none are wrong.

Personally, if a folder does not directly contain a component file, I think it should be lower-cased (ie. summarybox/SummaryBox)

@kylehilltruss @suzubara @haworku thoughts? Some people prefer snakeCase or kebab-case for multi-word directories. If we come to a consensus, I'll draft a PR + ADR to set them all straight 😉

src/components/SummaryBox/SummaryBox/SummaryBox.test.tsx Outdated Show resolved Hide resolved
import classnames from 'classnames'

interface SummaryBoxHeadingProps {
heading: string
Copy link
Contributor

@brandonlenz brandonlenz Mar 28, 2022

Choose a reason for hiding this comment

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

instead of a heading prop, can we use children here? That way the api can look like <SummaryBoxHeading>My Heading Content</SummaryBoxHeading>

That'll also allow more flexibility over just string in case someone wanted to otherwise stylize or pass in custom tags. (children should allow ReactNode as a type)

Copy link
Contributor

Choose a reason for hiding this comment

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

@Igarfinkle Did you decide to use heading prop anyway instead of children? I liked @brandonlenz 's suggestion

Copy link
Contributor

Choose a reason for hiding this comment

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

either way, a comment here to explain why it was resolved without changes would be helpful to future viewers.

@brandonlenz brandonlenz added the type: breaking This introduces breaking changes and will require a major version increase label Mar 28, 2022
brandonlenz
brandonlenz previously approved these changes Mar 30, 2022
Copy link
Contributor

@brandonlenz brandonlenz left a comment

Choose a reason for hiding this comment

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

Approving but with a couple of tiny things to fix listed below.

We'll likely want to time the release of this (since it's breaking), so lets work that out in our slack

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.

LGTM. I made #2000 to address the issue brandon brought up.

@brandonlenz brandonlenz self-requested a review April 19, 2022 22:39
Copy link
Contributor

@brandonlenz brandonlenz left a comment

Choose a reason for hiding this comment

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

Approving now since I think we've done all the communicating around an intentionally breaking release

@brandonlenz
Copy link
Contributor

@Igarfinkle when merging this, please make sure that the commit body of the merge commit contains some verbiage like

BREAKING CHANGE: SummaryBox now exposes sub-components (SummaryBoxHeading and SummaryBoxContent) for a more compositional API. Consumers will need to update their implementation to match.

@hgarfinkle hgarfinkle requested a review from rogeruiz as a code owner April 21, 2022 16:12
@hgarfinkle hgarfinkle merged commit a46ed35 into main Apr 21, 2022
@hgarfinkle hgarfinkle deleted the ig-1916-flexible-summary-box branch April 21, 2022 17:16
brandonlenz added a commit that referenced this pull request Apr 25, 2022
## [3.0.0](2.9.0...3.0.0) (2022-04-25)


### ⚠ BREAKING CHANGES

* Previous deprecated features and props have been removed. Please see the following guidance for affected components:
  * Accordion: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop.
  * Alert: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop.
  * Button: 
    * `accent` has been removed. Use `accentStyle` instead.
    * `big`, `small`, and `size="small"` have been removed. Use `size="big"` or do not define the `size` prop for default sizing.
  * CollectionHeading: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop.
  * Footer/Address: `big`, `medium`, and `slim` props have been removed. Use the `size` prop instead.
  * Footer/Footer: `big`, `medium`, and `slim` props have been removed. Use the `size` prop instead.
  * Footer/FooterNav: `big`, `medium`, and `small` props have been removed. Use the `size` prop instead.
  * Footer/Logo: `big`, `medium`, and `small` props have been removed. Use the `size` prop instead.
  * Search: `big`, and `small` props have been removed. Use the `size` prop instead.
  * Fieldset: `legendSrOnly` has been removed. Use `legendStyle="srOnly"` instead.
  * TextInput: `error`, and `success` props have been removed. Use the `validationStatus` prop instead.
  * header/NavList: `primary`, `secondary`, `subnav`, `megamenu`, and `footerSecondary` props have been removed. Use the `type` prop instead.
  * StepIndicator: Default heading level has been removed. Consumers must now specify via the `headingLevel` prop.
* SummaryBox now exposes sub-components (SummaryBoxHeading and SummaryBoxContent) for a more compositional API. Consumers will need to update their implementation to match.
* In order to accommodate IconList as a named component, Icons themselves needed to be refactored. All use of ReactUSWDS icons now follows the following syntax: <Icon.{IconName} /> instead of <Icon{IconName />. Furthermore, icons are no longer imported individually. Instead, Icon (the class) is imported to then use any <Icon.{IconName}> consumers require.

### Features

* add isInitiallyOpen option to modal ([#1971](#1971)) ([560564e](560564e))
* Make Summary Box more flexible ([#1929](#1929)) ([a46ed35](a46ed35))
* New Component: IconList ([#1691](#1691)) ([86589ac](86589ac))
* **ci:** add automerge priority label for Kodiak ([#1985](#1985)) ([9dc940e](9dc940e))


* Remove 1.x.x and 2.x.x deprecated properties ([#1988](#1988)) ([5dfadb1](5dfadb1))


### Documentation & Examples

* 404 page template added ([#2017](#2017)) ([0c9474d](0c9474d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: breaking This introduces breaking changes and will require a major version increase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[!feat] Make summary box components more flexible
5 participants