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

[KOA-6248] Add optional label to nudger component #2967

Merged
merged 7 commits into from
Aug 15, 2023
Merged

[KOA-6248] Add optional label to nudger component #2967

merged 7 commits into from
Aug 15, 2023

Conversation

anambl
Copy link
Contributor

@anambl anambl commented Aug 14, 2023

TL;DR

  • New props title, subtitle, icon to add a label to the nudger component.
  • Removed BpkNudgerRow component. This should not impact any projects in Skyscanner as it is a new component and we found no usages of it.
  • Change nudger styling to align with apps. This change might break visual tests.

Migrate to using the built-in nudger label

If you are using BpkNudger together with a label, consider passing the label content as props to inherit the accessible structure and styling of the component :accessibility:
To migrate, remove the label component and instead pass the title and subtitle and icon props accordingly.

Checkout the README.md for more details on the props.

<div>
  <BpkLabel id="passenger-label" htmlFor={id} className={labelClassName}>
      Number of passengers
  </BpkLabel>
  <BpkNudger
      aria-labelledby="passenger-label"
      id={id}
      min={1}
      max={10}
      value={value}
      onChange={handleChange}
      decreaseButtonLabel="Remove passenger"
      increaseButtonLabel="Add passenger"
      buttonType={buttonType}
   />
</div>

to

<div>
  <BpkNudger
      id={id}
      min={1}
      max={10}
      value={value}
      onChange={handleChange}
      decreaseButtonLabel="Remove passenger"
      increaseButtonLabel="Add passenger"
      title="Adults"
      subtitle="Aged 16+"
      icon={<AlignedAccountIcon />}
    />
</div>

Remember to include the following changes:

  • README.md (If you have created a new component)
  • Component README.md
  • Tests
  • Storybook examples created/updated
  • For breaking changes or deprecating components/properties, migration guides added to the description of the PR. If the guide has large changes, consider creating a new Markdown page inside the component's docs folder and link it here

@anambl anambl added the major Breaking change label Aug 14, 2023
@github-actions
Copy link

github-actions bot commented Aug 14, 2023

Browser support

If this is a visual change, make sure you've tested it in multiple browsers.

Generated by 🚫 dangerJS against 242d78d

@github-actions
Copy link

Visit https://backpack.github.io/storybook-prs/2967 to see this build running in a browser.

@github-actions
Copy link

Visit https://backpack.github.io/storybook-prs/2967 to see this build running in a browser.

@@ -129,22 +127,25 @@ class App extends Component {

### BpkConfigurableNudger
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we have 2 prop tables?
1 for one with label, one for without?

This way we can show the title is required etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm afraid that'd make it look like there's 2 separate components (as that is the only time when we have more than 1 api table) and that's not the case here, but maybe can add a comment in the api table that title is required if you want to show a label?

@anambl anambl marked this pull request as ready for review August 15, 2023 09:48
@github-actions
Copy link

Visit https://backpack.github.io/storybook-prs/2967 to see this build running in a browser.

@anambl anambl merged commit e8f3d31 into main Aug 15, 2023
7 checks passed
@anambl anambl deleted the KOA-6248 branch August 15, 2023 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
major Breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants