Skip to content

Commit

Permalink
feat(Button): update button text wrapping
Browse files Browse the repository at this point in the history
  • Loading branch information
JoannaSikora committed Jan 29, 2025
1 parent ca526ca commit 26d43c6
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@ $base-class: 'btn';
}

&--xcompact {
@include size.button-size($base-class, 2px, 12px, 24px, 24px);
@include size.button-size($base-class, 2px, 12px, 24px);
}

&--compact {
@include size.button-size($base-class, 6px, 16px, 32px, 32px);
@include size.button-size($base-class, 6px, 16px, 32px);
}

&--medium {
@include size.button-size($base-class, 8px, 16px, 36px, 36px);
@include size.button-size($base-class, 8px, 16px, 36px);
}

&--large {
@include size.button-size($base-class, 11px, 16px, 44px, 44px);
@include size.button-size($base-class, 11px, 16px, 44px);
}

&--basic {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
text-align: center;
text-decoration: none;
line-height: 20px;
white-space: nowrap;
font-size: 14px;
font-weight: 600;
user-select: none;
Expand Down
73 changes: 63 additions & 10 deletions packages/react-components/src/components/Button/styles/icon.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'sass:map';

@mixin icon-styles() {
width: 20px;
height: 20px;
Expand All @@ -20,17 +22,68 @@
}

@mixin icon-only($base-class) {
padding: 4px;

&.#{$base-class} {
&--xcompact {
padding: 4px;
width: 24px;
height: 24px;

.#{$base-class}__icon {
width: 16px;
height: 16px;
$sizes: (
'xcompact': (
'padding': 4px,
'size': 24px,
'icon-size': 16px,
),
'compact': (
'padding': 6px,
'size': 32px,
'icon-size': 20px,
),
'medium': (
'padding': var(--spacing-2),
'size': 36px,
'icon-size': 20px,
),
'large': (
'padding': var(--spacing-3),
'size': 44px,
'icon-size': 20px,
),
);

@each $size-name, $values in $sizes {
&--#{$size-name} {
padding: map.get($values, 'padding');
width: map.get($values, 'size');
height: map.get($values, 'size');

.#{$base-class}__icon {
width: map.get($values, 'icon-size');
height: map.get($values, 'icon-size');
}
}
}

&--text-lock-black {
@each $size-name, $values in $sizes {
&.#{$base-class}--#{$size-name} {
padding: 0;
height: 24px;
}
}
}

&--link-light,
&--link-inverted {
@each $size-name, $values in $sizes {
&.#{$base-class}--#{$size-name} {
padding: 0;

@if $size-name == 'xcompact' {
width: 24px;
height: 24px;
}

@else {
width: 28px;
height: 28px;
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@mixin button-size($base-class, $padding-v, $padding-h, $min-width, $height) {
@mixin button-size($base-class, $padding-v, $padding-h, $height) {
padding: $padding-v $padding-h;
min-width: $min-width;
height: $height;

&.#{$base-class} {
Expand Down

0 comments on commit 26d43c6

Please sign in to comment.