Skip to content

Commit

Permalink
fix: table: fix loading compare and updates default spinner size and …
Browse files Browse the repository at this point in the history
…position (#627)

* fix: table: fix loading compare and updates default spinner size and position

* chore: table�: inherit spinner div height
  • Loading branch information
dkilgore-eightfold authored May 31, 2023
1 parent 71c490b commit b0b830e
Show file tree
Hide file tree
Showing 4 changed files with 247 additions and 208 deletions.
7 changes: 7 additions & 0 deletions src/components/Table/Styles/table.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,13 @@
}
}

.table-spinner {
align-items: center;
display: flex;
height: inherit;
justify-content: center;
}

.table-filter-dropdown {
&-tree {
padding: 8px 8px 0;
Expand Down
5 changes: 5 additions & 0 deletions src/components/Table/Table.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ export default {
onRowHoverLeave: {
action: 'onMouseLeave',
},
loading: {
options: [true, false],
control: { type: 'inline-radio' },
},
},
} as ComponentMeta<typeof Component>;

Expand Down Expand Up @@ -1409,6 +1413,7 @@ const tableArgs: Object = {
bordered: true,
classNames: 'my-table-class',
id: 'myTableId',
loading: false,
columns: basicCols,
dataSource: data,
pagination: {
Expand Down
14 changes: 11 additions & 3 deletions src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -687,10 +687,18 @@ function InternalTable<RecordType extends object = any>(
}
}

if (typeof loading === 'boolean') {
return <Spinner size={SpinnerSize.Large} />;
if (typeof loading === 'boolean' && loading) {
return (
<div className={styles.tableSpinner}>
<Spinner />
</div>
);
} else if (typeof loading === 'object') {
return <Spinner size={SpinnerSize.Large} />;
return (
<div className={styles.tableSpinner}>
<Spinner {...loading} />
</div>
);
}

const renderEmpty = (
Expand Down
Loading

0 comments on commit b0b830e

Please sign in to comment.