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

Fix euiFormControlIsLoading mixin to prevent the loading icon overlapping when compressed #3401

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
- Added `ReactElement` to `EuiCard` `image` prop type to allow custom component ([#3370](https://github.com/elastic/eui/pull/3370))
- Fixed `EuiCollapsibleNavGroup` `titleSize` prop type to properly exclude `l` and `m` sizes ([#3365](https://github.com/elastic/eui/pull/3365))
- Fixed `EuiDatePickerRange` start date popover to sit left under the icon ([#3383](https://github.com/elastic/eui/pull/3383))
- Fixed `euiFormControlIsLoading` SASS mixin to prevent the loading icon from overlapping with the text when the form control is `compressed` and adjusted the amount of padding ([#3401](https://github.com/elastic/eui/pull/3401)
- Fixed `EuiHeader` `z-index` issues with popovers and added body classes for the presence of `EuiFlyout` and `EuiCollapsibleNav.isOpen` ([#3398](https://github.com/elastic/eui/pull/3398))

## [`23.1.0`](https://github.com/elastic/eui/tree/v23.1.0)
Expand Down
22 changes: 15 additions & 7 deletions src/global_styling/mixins/_form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
}

@mixin euiFormControlLayoutPadding($numOfIcons, $side: 'right', $compressed: false) {
$firstIconSize: $euiFormControlPadding + $euiSize + $euiFormControlPadding;
$secondIconSize: $euiFormControlPadding + $euiSize;
$iconSize: $euiSize;
$iconPadding: $euiFormControlPadding;
$marginBetweenIcons: $euiFormControlPadding / 2;

@if ($compressed) {
$firstIconSize: $euiFormControlCompressedPadding + $euiSize + $euiFormControlCompressedPadding;
$secondIconSize: $euiFormControlCompressedPadding + $euiSize;
$iconPadding: $euiFormControlCompressedPadding;
}

@if variable-exists(numOfIcons) == false {
@error '$numOfIcons:integer (1-3) must be provided to @mixin euiFormControlLayoutPadding().';
} @else if $numOfIcons == 1 {
padding-#{$side}: $firstIconSize;
padding-#{$side}: $iconPadding + $iconSize + $iconPadding;
} @else if $numOfIcons == 2 {
padding-#{$side}: $firstIconSize + $secondIconSize;
padding-#{$side}: $iconPadding + $iconSize + $marginBetweenIcons + $iconSize + $iconPadding;
} @else if $numOfIcons == 3 {
padding-#{$side}: $firstIconSize + ($secondIconSize * 2);
padding-#{$side}: $iconPadding + $iconSize + $marginBetweenIcons + $iconSize + $marginBetweenIcons + $iconSize + $iconPadding;
}
}

Expand Down Expand Up @@ -122,6 +122,14 @@
@include euiFormControlLayoutPadding(1);
}
}

#{&}-isLoading#{&}--compressed {
@if ($isNextToIcon) {
@include euiFormControlLayoutPadding(2, $compressed: true);
} @else {
@include euiFormControlLayoutPadding(1, $compressed: true);
}
}
}
}

Expand Down