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

Sage/DSY-1746 Button Toggle styling changes #6217

Merged
merged 2 commits into from
Dec 6, 2023

Conversation

DobroTora
Copy link
Contributor

@DobroTora DobroTora commented Jul 25, 2023

Proposed behaviour

New Styling Added to Button Toggle component

Current behaviour

New Styling added to Button Toggle

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
  • Cypress 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 CodeSandbox/storybook
  • Add new Cypress test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

The following CodeSandbox is an example of the broken behaviour.
You can see the new behaviour by looking at the version in the comment by codesandbox[bot].

@DobroTora DobroTora requested review from a team as code owners July 25, 2023 07:43
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch from c6bea56 to 51bb52c Compare July 25, 2023 08:06
@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 25, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d02e0cc:

Sandbox Source
carbon-quickstart Configuration
carbon-quickstart-typescript Configuration
carbon-quickstart PR

@DobroTora DobroTora marked this pull request as draft July 25, 2023 09:40
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch 2 times, most recently from f348b97 to d87a932 Compare July 25, 2023 12:08
@DobroTora DobroTora changed the title Sage/dsy 1746 button toggle minor child Sage/DSY-1746 Button Toggle minor child Jul 27, 2023
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch from e52d4ca to 4bcc76b Compare July 27, 2023 11:23
@tomdavies73 tomdavies73 self-requested a review July 28, 2023 10:05
@DobroTora DobroTora requested a review from edleeks87 July 28, 2023 13:06
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.

We'll need to prevent the content jumping when the minor buttons are pressed/ activated

https://codesandbox.io/s/carbon-quickstart-forked-f82m7p?file=/src/App.js see for example of what I mean

src/components/button-toggle/button-toggle.style.ts Outdated Show resolved Hide resolved
var(--spacing100);
}

&:focus {
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment: you don't need this as far as I can tell. You should style it using the aria-pressed=true attribute similar to how it is achieved above. You'll also need to the padding imo as when the toggle button is active the increased border thickness will cause the layout to jump so the padding will need to be reduced when that happens to avoid it. Something like the below will work:

color: var(--colorsActionMinor500);
      border: 1px solid var(--colorsActionMinor500);

      &[aria-pressed="true"] {
        border: 4px solid var(--colorsActionMinor500);
        background-color: transparent;
        padding: 0 ${paddingConfig[size] - 3}px;
        
        :hover {
          background-color: var(--colorsActionMinor600);
          color: var(--colorsUtilityYang100);
          border-color: var(--colorsActionMinor600);
        }
      }

      :not([aria-pressed="true"]):not(:disabled):hover {
        color: var(--colorsActionMinorYang100);
        background-color: var(--colorsActionMinor600);
        border-color: var(--colorsActionMinor600);
      }

Copy link
Contributor

Choose a reason for hiding this comment

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

https://codesandbox.io/s/carbon-quickstart-forked-f82m7p?file=/src/App.js

If you click one of the buttons you will see the content jumping

src/components/button-toggle/button-toggle.style.ts Outdated Show resolved Hide resolved
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch 2 times, most recently from db7feb9 to eaa88d0 Compare August 25, 2023 10:21
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch 2 times, most recently from 4c497ff to 653f748 Compare September 1, 2023 15:38
edleeks87
edleeks87 previously approved these changes Nov 16, 2023
@harpalsingh harpalsingh marked this pull request as ready for review November 21, 2023 10:02
@DobroTora DobroTora dismissed stale reviews from edleeks87 and nineteen88 via 83d6d5b November 27, 2023 14:50
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch from 83d6d5b to c814b34 Compare November 27, 2023 14:55
@DobroTora DobroTora marked this pull request as draft November 27, 2023 14:55
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch from c814b34 to 08d3bc8 Compare November 27, 2023 14:58
@harpalsingh harpalsingh marked this pull request as ready for review November 28, 2023 11:05
edleeks87
edleeks87 previously approved these changes Nov 28, 2023
nineteen88
nineteen88 previously approved these changes Nov 28, 2023
stephenogorman
stephenogorman previously approved these changes Dec 1, 2023
feat(button-toggle): rm variant prop

feat(button-toggle): rm variant prop, tests

feat(button-toggle): fix ts errors

feat(button-toggle): update snaps

feat(button-toggle): rm variant prop
@DobroTora DobroTora force-pushed the Sage/DSY-1746-Button-Toggle-Minor-Child branch from 08d3bc8 to 864f005 Compare December 5, 2023 10:57
@edleeks87 edleeks87 merged commit e35a079 into master Dec 6, 2023
23 checks passed
@edleeks87 edleeks87 deleted the Sage/DSY-1746-Button-Toggle-Minor-Child branch December 6, 2023 11:20
@carbonci
Copy link
Collaborator

carbonci commented Dec 6, 2023

🎉 This PR is included in version 124.2.0 🎉

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.

7 participants