Skip to content

Commit

Permalink
fix(loading): updates upon review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
asudoh committed Oct 21, 2019
1 parent 570f204 commit 27e1b13
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@
}

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

.#{$prefix}--file-filename {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,7 @@
}

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

.#{$prefix}--loading__background,
.#{$prefix}--loading__stroke {
// Ensures (r * 2 + (stroke width)) / (viewbox unit size) * (viewbox pixel size) === 14
r: 26.8125;
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}}
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

0 comments on commit 27e1b13

Please sign in to comment.