Skip to content

Commit

Permalink
fix(button): add min-height and bottom padding for wrapping (#14193)
Browse files Browse the repository at this point in the history
* fix(button): add min-height and bottom padding for wrapping

* chore: demo story

* fix: code snippet and overflow menu button styles

* fix: code snippet button height

* chore: add large expressive to demo

* chore: update demo story for expressive

* fix: expressive large button

* chore: remove demo story
  • Loading branch information
alisonjoseph committed Jul 13, 2023
1 parent 4fec533 commit 5391d96
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/react/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ interface ButtonBaseProps
iconDescription?: string;

/**
* Specify whether the Button is expressive, or not
* Specify whether the Button is expressive, or not. Only applies to the large/default button size.
*/
isExpressive?: boolean;

Expand Down
5 changes: 5 additions & 0 deletions packages/styles/scss/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@
//expressive styles
.#{$prefix}--btn--expressive {
@include type-style('body-compact-02');

padding-block: min(
calc((layout.size('height') - var(--temp-expressive-1lh)) / 2 - rem(1px)),
var(--temp-padding-block-max)
);
}

.#{$prefix}--btn--icon-only.#{$prefix}--btn--expressive {
Expand Down
10 changes: 8 additions & 2 deletions packages/styles/scss/components/button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ $button-focus-color: custom-property.get-var('button-focus-color', $focus);
map.get($body-compact-01, line-height)
)} * 1em
);
--temp-expressive-1lh: (
#{custom-property.get-var(
'body-compact-02-line-height',
map.get($body-compact-02, line-height)
)} * 1em
);
// -1px to compensate for border width
--temp-padding-block-max: calc(
(#{custom-property.get-var('layout-size-height-lg')} - var(--temp-1lh)) / 2 -
Expand All @@ -42,7 +48,7 @@ $button-focus-color: custom-property.get-var('button-focus-color', $focus);
display: inline-flex;
width: max-content;
max-width: rem(320px);
height: layout.size('height');
min-height: layout.size('height');
flex-shrink: 0;
justify-content: space-between;
// Fix to remove added margins on buttons in safari (see #5155)
Expand All @@ -51,7 +57,7 @@ $button-focus-color: custom-property.get-var('button-focus-color', $focus);
cursor: pointer;
outline: none;
// -1px to compensate for border width
padding-block-start: min(
padding-block: min(
calc((layout.size('height') - var(--temp-1lh)) / 2 - rem(1px)),
var(--temp-padding-block-max)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ $copy-btn-feedback: $background-inverse !default;
.#{$prefix}--snippet--inline.#{$prefix}--btn {
width: initial;
height: 1.25rem;
min-height: 1.25rem;
padding-inline: 0;
}

Expand Down Expand Up @@ -334,6 +335,7 @@ $copy-btn-feedback: $background-inverse !default;
right: 0;
bottom: 0;
display: inline-flex;
height: rem(32px);
align-items: center;

padding: $spacing-03 $spacing-05;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
display: flex;
width: rem(40px);
height: rem(40px);
min-height: rem(40px);
align-items: center;
justify-content: center;
cursor: pointer;
Expand Down

0 comments on commit 5391d96

Please sign in to comment.