Skip to content

Commit

Permalink
fix: Table Bug Fixes (#234)
Browse files Browse the repository at this point in the history
* Make x and y values for isScrollable prop optional.

* fix: prevent scrolling in loading state; make x and y scroll props optional.

* Set 100% height on Table's container only if scrolling on the Y is enabled.
  • Loading branch information
Jesse Carmine authored Sep 14, 2020
1 parent 922993c commit 15e9ca7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/Table/Table.module.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.container {
position: relative;
width: 100%;
height: 100%;

.loading-mask {
display: flex;
Expand Down Expand Up @@ -54,4 +52,8 @@
}
}
}

&.full-height {
height: 100%;
}
}
9 changes: 8 additions & 1 deletion src/components/Table/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ const Table: FC<TableProps> = ({
useFixedTableLayout = false,
truncateOverflow = false,
}) => {
const containerClasses = classNames(
styles.container,
{
[styles['full-height']]: !!isScrollable?.y,
},
);

const scrollContainerClasses = classNames(
styles['scroll-container'],
{
Expand All @@ -125,7 +132,7 @@ const Table: FC<TableProps> = ({
);

return (
<div className={styles.container}>
<div className={containerClasses}>
{isLoading && (
<div className={styles['loading-mask']}>
<Spinner size="xl" />
Expand Down

0 comments on commit 15e9ca7

Please sign in to comment.