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

fix(button-toggle): long text overflows button and update large icon padding #6833

Merged
merged 1 commit into from
Jul 25, 2024

Conversation

nuria1110
Copy link
Contributor

@nuria1110 nuria1110 commented Jul 15, 2024

fix #6799

Proposed behaviour

  • Padding of ButtonToggle with a large icon is aligned with designs.
  • Small con size is 20px.
  • When a ButtonToggle with long text content wraps in smaller screens, the button's height is adjusted to fit the wrapped text and is centre aligned.
Screenshot 2024-07-15 at 10 40 04

Current behaviour

  • Padding of ButtonToggle with a large icon is not aligned with designs.
  • Small icon size is 24px.
  • When a ButtonToggle with long text content wraps in smaller screens, the text overflows the button and is not centre aligned.
Screenshot 2024-07-15 at 10 42 29

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

  • "Wrapped Buttons" story is intended to have more wrapped buttons in the Chromatic snapshot, this done to capture this specific behaviour.

Testing instructions

  • See added "Large Icon With Long Text" test story for bug fix.

DipperTheDan
DipperTheDan previously approved these changes Jul 16, 2024
@edleeks87 edleeks87 marked this pull request as ready for review July 17, 2024 09:33
@edleeks87 edleeks87 requested review from a team as code owners July 17, 2024 09:33
Copy link
Contributor

@edleeks87 edleeks87 left a comment

Choose a reason for hiding this comment

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

Really good stuff @nuria1110, my comments are non-blocking let me know what you think I'm happy to approve if you disagree 😄

small: 24,
medium: 40,
large: 48,
small: "8px",
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (non-blocking): might be worth using the tokens here, don't mind if it's a new bit of work as there's several config objects in this file that use hardcoded values

const paddingLargeIconConfig = {
  small: "var(--spacing100)",
  medium: "var(--spacing100) var(--spacing150) var(--spacing000)",
  large: "var(--spacing100) var(--spacing300)",
};

@@ -378,11 +378,12 @@ export const DisabledGroup: Story = () => (
DisabledGroup.storyName = "Disabled Group";

export const WrappedButtons: Story = () => (
<Box width="350px" display="flex" flexWrap="nowrap">
<Box width="375px" display="flex" flexWrap="nowrap">
Copy link
Contributor

Choose a reason for hiding this comment

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

comment (non-blocking): we could set the width to be smaller when run in chromatic here so we get a snapshot of them stacked fully vertically

image

 const inChromatic = isChromatic();

  <Box width={inChromatic ? "175px" : "375px"} display="flex" flexWrap="nowrap">

Copy link
Contributor

Choose a reason for hiding this comment

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

alternatively you could add a test story and capture the example you've screenshotted in the above PR description if you prefer that

…padding

Fixes issue where longer text content overflows buttons when they wrap in smaller screens. Also
updates button padding in buttons with large icons.

fix #6799
@nuria1110 nuria1110 merged commit 1f34b91 into master Jul 25, 2024
21 checks passed
@nuria1110 nuria1110 deleted the FE-6677-6681 branch July 25, 2024 09:04
@carbonci
Copy link
Collaborator

🎉 This PR is included in version 141.0.7 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

ButtonToggleGroup: button toggles with different text sizes do not wrap uniformly
6 participants