Skip to content

Commit

Permalink
fix(Loading): remove extra padding on loading spinners (#7447)
Browse files Browse the repository at this point in the history
Co-authored-by: Alessandra Davila <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 14, 2020
1 parent b0ecf07 commit 2bb2cc7
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,6 @@
margin: 0;
}

.#{$prefix}--loading {
width: rem(32px);
height: rem(32px);
margin-right: -$carbon--spacing-03;
}

.#{$prefix}--inline-loading__animation .#{$prefix}--loading {
// Vanilla markup has `.bx--inline-loading__animation` which is used for `margin-right` adjustment
margin-right: 0;
Expand Down
11 changes: 6 additions & 5 deletions packages/components/src/components/loading/_loading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

.#{$prefix}--loading__svg circle {
stroke-width: 8;
stroke-width: 10;
stroke-linecap: butt;
stroke-dasharray: 240;
}
Expand All @@ -49,10 +49,11 @@
}

.#{$prefix}--loading--small {
width: 2rem;
height: 2rem;
width: rem(16px);
height: rem(16px);

circle {
stroke-width: 12;
stroke-width: 16;
}
}

Expand All @@ -62,7 +63,7 @@

.#{$prefix}--loading__background {
stroke: $ui-03;
stroke-dashoffset: 0;
stroke-dashoffset: -22;
}

.#{$prefix}--loading-overlay {
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/components/loading/_vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
/// @type Number
/// @access private
/// @group loading
$loading__gap: 40;
$loading__gap: 16;

/// @type Number
/// @access private
/// @group loading
$loading--small__gap: 99;
$loading--small__gap: 25;

/// @type Number
/// @access private
/// @group loading
$loading__size: 10.5rem;
$loading__size: 5.5rem;
12 changes: 6 additions & 6 deletions packages/react/src/components/Loading/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function Loading({
[`${prefix}--loading-overlay--stop`]: !active,
});
const loadingId = id || `loading-id-${instanceId}`;
const spinnerRadius = small ? '26.8125' : '37.5';
const spinnerRadius = small ? '42' : '44';

const loading = (
<div
Expand All @@ -46,20 +46,20 @@ function Loading({
<label id={loadingId} className={`${prefix}--visually-hidden`}>
{description}
</label>
<svg className={`${prefix}--loading__svg`} viewBox="-75 -75 150 150">
<svg className={`${prefix}--loading__svg`} viewBox="0 0 100 100">
<title>{description}</title>
{small ? (
<circle
className={`${prefix}--loading__background`}
cx="0"
cy="0"
cx="50%"
cy="50%"
r={spinnerRadius}
/>
) : null}
<circle
className={`${prefix}--loading__stroke`}
cx="0"
cy="0"
cx="50%"
cy="50%"
r={spinnerRadius}
/>
</svg>
Expand Down

0 comments on commit 2bb2cc7

Please sign in to comment.