Skip to content

Commit

Permalink
fix(styles): wrap button group overflow (#3062)
Browse files Browse the repository at this point in the history
  • Loading branch information
alizedebray authored Jun 18, 2024
1 parent 2a1e959 commit e2c21e1
Show file tree
Hide file tree
Showing 3 changed files with 265 additions and 198 deletions.
5 changes: 5 additions & 0 deletions .changeset/yellow-spies-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@swisspost/design-system-styles': patch
---

Implemented button wrapping for overflow in button groups.
22 changes: 6 additions & 16 deletions packages/styles/src/components/button-group.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,21 @@

@use './../mixins/utilities';
@use './../variables/color';
@use './../variables/spacing';
@use './../variables/components/button';
@use './../variables/components/forms';

.btn-group {
max-width: 100%;
flex-wrap: wrap;
row-gap: spacing.$size-micro;
padding-inline-start: button.$btn-border-width;

> .btn {
white-space: normal;
cursor: pointer;

// added a transition delay on the "z-index" so the button only moves back after all other transitions
z-index: 0;
transition:
z-index 0s ease (0.5 * button.$btn-transition-duration),
button.$btn-transition;

@include utilities.high-contrast-mode() {
transition: none !important;
}
}

> .btn:hover {
// remove the transition delay on the "z-index" for all raised states so the button moves forward before other transitions
z-index: 2 !important;
transition: button.$btn-transition;
flex: 0 1 auto;
margin-inline-start: -1 * button.$btn-border-width;
}

> .btn-secondary {
Expand Down
Loading

0 comments on commit e2c21e1

Please sign in to comment.