Skip to content

Commit

Permalink
Fixed spinner alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Sep 25, 2023
1 parent b55a972 commit 7898ba7
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion packages/code-studio/src/styleguide/Tooltips.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function Tooltips(): React.ReactElement {
<hr />
<div>And some icons down here</div>
<div>
<LoadingSpinner />
<LoadingSpinner className="mimic-fa-layers-vertical-align" />
{iconElements}
</div>
</Tooltip>
Expand Down
9 changes: 9 additions & 0 deletions packages/components/scss/BaseStyleSheet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,15 @@ span.btn-disabled-wrapper {
}
}

.btn-spinner .loading-spinner,
.mimic-fa-layers-vertical-align {
// The original LoadingSpinner used `.fa-layers` to create the spinner icon.
// This includes a vertical aligment adjustment to center the spinner along
// side of other inline content. Copying this value from the `.fa-layers`
// class to avoid breaking alignment of the new spinner.
vertical-align: -0.125em;
}

.btn-link.no-underline,
.btn-link.no-underline:hover {
text-decoration: none;
Expand Down
8 changes: 0 additions & 8 deletions packages/components/src/LoadingSpinner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,11 @@
margin: 0 auto;
width: var(--size);
height: var(--size);

// The original LoadingSpinner used `.fa-layers` to create the spinner icon.
// This vertical-align value was copied from the `.fa-layers` class to avoid
// breaking alignment in existing usages such as `ContextActions` and
// `.btn-spinner`
vertical-align: -0.125em;
}

.loading-spinner-large {
--border-width: 4px;
--size: 56px;

vertical-align: 0;
}

// Spinning circle with colored border and transparent center. Half of the
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/context-actions/ContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ class ContextMenu extends PureComponent<ContextMenuProps, ContextMenuState> {
if (pendingItems.length > 0) {
pendingElement = (
<div className="loading">
<LoadingSpinner />
<LoadingSpinner className="mimic-fa-layers-vertical-align" />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export class CommandHistoryItemTooltip extends Component<
{hasTimeString ? (
<span className="time-string">{timeString}</span>
) : (
<LoadingSpinner />
<LoadingSpinner className="mimic-fa-layers-vertical-align" />
)}
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions packages/iris-grid/src/ColumnStatistics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,6 @@
display: inline-block;
color: $gray-400;
}
.column-statistics-loading .loading-spinner {
margin-right: 5px;
}
2 changes: 1 addition & 1 deletion packages/iris-grid/src/ColumnStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ class ColumnStatistics extends Component<
)}
{loading && (
<div className="column-statistics-loading">
<LoadingSpinner className="mr-2" />
<LoadingSpinner className="mimic-fa-layers-vertical-align" />
Calculating Stats...
</div>
)}
Expand Down
3 changes: 2 additions & 1 deletion packages/iris-grid/src/IrisGridBottomBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ $ease-out-bounce-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);

.btn {
min-width: 10rem;
.svg-inline--fa {
.svg-inline--fa,
.loading-spinner {
margin-right: 0.5rem;
}
}
Expand Down
4 changes: 3 additions & 1 deletion packages/iris-grid/src/IrisGridCopyHandler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,9 @@ class IrisGridCopyHandler extends Component<
onClick={this.handleCopyClick}
disabled={isFetching}
>
{isFetching && <LoadingSpinner />}
{isFetching && (
<LoadingSpinner className="mimic-fa-layers-vertical-align" />
)}
{copyButtonText}
</Button>
</div>
Expand Down

0 comments on commit 7898ba7

Please sign in to comment.