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(inline-loading): shrink spinner radius #4382

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@
}

.#{$prefix}--loading {
width: $carbon--spacing-06;
height: $carbon--spacing-06;
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;
}

.#{$prefix}--file-filename {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
<div class="{{prefix}}--inline-loading__animation">
<div data-inline-loading-spinner="" class="{{prefix}}--loading {{prefix}}--loading--small">
<svg class="{{prefix}}--loading__svg" viewBox="-75 -75 150 150">
<circle class="{{prefix}}--loading__background" cx="0" cy="0" r="37.5"></circle>
<circle class="{{prefix}}--loading__stroke" cx="0" cy="0" r="37.5"></circle>
<circle class="{{prefix}}--loading__background" cx="0" cy="0" r="26.8125"></circle>
<circle class="{{prefix}}--loading__stroke" cx="0" cy="0" r="26.8125"></circle>
</svg>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

.#{$prefix}--loading__stroke {
stroke-dashoffset: 99;
stroke-dashoffset: $loading--small__gap;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<div class="{{@root.prefix}}--inline-loading__animation">
<div data-inline-loading-spinner class="{{@root.prefix}}--loading {{@root.prefix}}--loading--small">
<svg class="{{@root.prefix}}--loading__svg" viewBox="-75 -75 150 150">
<circle class="{{@root.prefix}}--loading__background" cx="0" cy="0" r="30" />
<circle class="{{@root.prefix}}--loading__stroke" cx="0" cy="0" r="30"/>
<circle class="{{@root.prefix}}--loading__background" cx="0" cy="0" r="26.8125" />
<circle class="{{@root.prefix}}--loading__stroke" cx="0" cy="0" r="26.8125"/>
</svg>
</div>
{{ carbon-icon "CheckmarkFilled16" data-inline-loading-finished='' hidden='' class=(add @root.prefix '--inline-loading__checkmark-container') }}
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/components/loading/_loading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
stroke-dashoffset: $loading__gap;
}

.#{$prefix}--loading--small .#{$prefix}--loading__stroke {
stroke-dashoffset: $loading--small__gap;
}

.#{$prefix}--loading--stop {
@include animation__loading--stop;
}
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/components/loading/_vars.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
/// @group loading
$loading__gap: 40;

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

/// @type Number
/// @access private
/// @group loading
Expand Down
6 changes: 5 additions & 1 deletion packages/components/src/components/loading/loading.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
<div data-loading class="{{@root.prefix}}--loading{{#if small}} {{@root.prefix}}--loading--small{{/if}}">
<svg class="{{@root.prefix}}--loading__svg" viewBox="-75 -75 150 150">
<title>Loading</title>
{{#if small}}<circle class="{{@root.prefix}}--loading__background" cx="0" cy="0" r="37.5" />{{/if}}
{{#if small}}
<circle class="{{@root.prefix}}--loading__background" cx="0" cy="0" r="26.8125" />
<circle class="{{@root.prefix}}--loading__stroke" cx="0" cy="0" r="26.8125" />
{{else}}
<circle class="{{@root.prefix}}--loading__stroke" cx="0" cy="0" r="37.5" />
{{/if}}
</svg>
</div>
{{#if overlay}}</div>{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ exports[`Filename renders as expected renders upload status icon as expected 1`]
className="bx--loading__background"
cx="0"
cy="0"
r="37.5"
r="26.8125"
/>
<circle
className="bx--loading__stroke"
cx="0"
cy="0"
r="37.5"
r="26.8125"
/>
</svg>
</div>
Expand Down
6 changes: 4 additions & 2 deletions packages/react/src/components/Loading/Loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ export default class Loading extends React.Component {
[`${prefix}--loading-overlay--stop`]: !active,
});

const spinnerRadius = small ? '26.8125' : '37.5';

const loading = (
<div
{...other}
Expand All @@ -79,14 +81,14 @@ export default class Loading extends React.Component {
className={`${prefix}--loading__background`}
cx="0"
cy="0"
r="37.5"
r={spinnerRadius}
/>
) : null}
<circle
className={`${prefix}--loading__stroke`}
cx="0"
cy="0"
r="37.5"
r={spinnerRadius}
/>
</svg>
</div>
Expand Down