Skip to content

Commit

Permalink
chore(button-group): make minor styling adjustments (#1686)
Browse files Browse the repository at this point in the history
* Remove bottom margin from btn-group

Addresses StackEng/StackOverflow#18992 (review)

See also StackEng/StackOverflow#18992 (comment)

* Match update btn height to match btn-group to related btn heights

Addresses StackEng/StackOverflow#18992 (review)

* More slight padding adjustments

* Ensure badge doesn't affect button group height

Addresses StackEng/StackOverflow#18992 (review)

* Remove unneeded comment

* Add temp docs examples

* Udpate btn-group test images

* Remove temp examples from btn-group docs page
  • Loading branch information
dancormier authored Mar 22, 2024
1 parent f0e222a commit 8ddc607
Show file tree
Hide file tree
Showing 61 changed files with 137 additions and 132 deletions.
29 changes: 17 additions & 12 deletions lib/components/button-group/button-group.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,27 @@
margin-right: calc(var(--su-static1) * -1); // -1px
}

// --_bu-py values set below to ensure btn-group height matches same-sized button height
// See https://github.com/StackEng/StackOverflow/pull/18992#pullrequestreview-1947490680
.s-btn {
--_bu-br: var(--br-sm);
--_bu-bc-hover: transparent;
--_bu-px: calc(var(--su12) - var(--su1)); // 11px
--_bu-py: calc(var(--su6) + 0.65px); // 6.65px

&,
&.s-btn__md {
--_bu-px: var(--su12);
--_bu-py: var(--su8);
&.s-btn__xs {
--_bu-px: calc(var(--su8) - var(--su1)); // 7px
--_bu-py: calc(var(--su2) + 0.9px); // 2.9px
}

&.s-btn___xs {
--_bu-px: var(--su8);
--_bu-py: var(--su4);
&.s-btn__sm {
--_bu-px: calc(var(--su8) + var(--su1)); // 9px
--_bu-py: calc(var(--su4) + (var(--su2) - 0.15px)); // 5.85px
}

&.s-btn___sm {
--_bu-px: calc(var(--su8) + var(--su2));
--_bu-py: var(--su6);
&.s-btn__md {
--_bu-px: var(--su12);
--_bu-py: calc(var(--su8) + 0.15px); // 8.15px
}

&.is-selected,
Expand All @@ -46,6 +49,9 @@
}

.s-btn--badge {
// set negative margins so button height isn't affect by badge
margin-bottom: -100%;
margin-top: -100%;
font-weight: normal;
}

Expand All @@ -70,8 +76,7 @@
// STATIC COMPONENT STYLES
border: var(--su-static1) solid var(--black-300);
border-radius: var(--br-md);
display: inline-flex; // TODO investigate if changing from flex to inline-flex will be an issue
display: inline-flex;
flex-wrap: wrap;
margin-bottom: var(--su-static1); // Compensate for buttons having a margin bottom of -1px to account for row wrapping
padding: calc(var(--su-static4) - var(--su-static1));
}
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-dark-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-dark-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-dark-radio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-dark-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-light-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-light-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-light-radio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-light-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Chromium/baseline/s-btn-group-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-dark-badge.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-dark-form.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-dark-radio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-dark-single.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-light-badge.png
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-light-form.png
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-light-radio.png
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-light-single.png
4 changes: 2 additions & 2 deletions screenshots/Firefox/baseline/s-btn-group-light.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-dark-badge.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-dark-form.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-dark-radio.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-dark-single.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-dark.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-highcontrast-dark.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-light-badge.png
4 changes: 2 additions & 2 deletions screenshots/Webkit/baseline/s-btn-group-light-form.png
Loading

0 comments on commit 8ddc607

Please sign in to comment.