Skip to content

Commit 649db93

Browse files
table loader (#8)
Co-authored-by: Lennart Schmidt <lennart.schmidt@kern.ai>
1 parent 352db74 commit 649db93

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

components/NoTableEntriesYet.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
import { memo } from "react";
22
import { useDefaults } from "../hooks/useDefaults";
33
import { NO_TABLE_ENTRIES_YET_DEFAULTS, NoTableEntriesYetProps } from "../types/noTableEntriesYet";
4-
4+
import { Loading } from '@nextui-org/react';
55

66
function GetNoTableEntriesYet(_props: NoTableEntriesYetProps) {
77
const [props] = useDefaults<NoTableEntriesYetProps>(_props, NO_TABLE_ENTRIES_YET_DEFAULTS);
88

99
return <tr>
1010
<td colSpan={props.tableColumns}>
1111
<div className={`flex justify-center items-center w-full text-sm ${props.heightClass + " " + props.backgroundColorClass + " " + props.textColorClass + " " + props.marginBottomClass}`}>
12-
{props.text}
12+
{props.loading?
13+
<div className={`flex ${props.loadingColorClass}`}>
14+
<Loading size="md" type="spinner" color="currentColor"/>
15+
</div>
16+
:
17+
props.text}
1318
</div>
1419
</td>
1520
</tr>

types/noTableEntriesYet.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export type NoTableEntriesYetProps = {
1616
backgroundColorClass?: string;
1717
textColorClass?: string;
1818
marginBottomClass?: string; // can be used to offset common table paddings, usually negative
19+
loading?: boolean
20+
loadingColorClass?: string
1921
}
2022

2123

@@ -25,4 +27,6 @@ export const NO_TABLE_ENTRIES_YET_DEFAULTS = {
2527
backgroundColorClass: 'bg-gray-50',
2628
textColorClass: 'text-gray-700',
2729
marginBottomClass: "",
30+
loading: false,
31+
loadingColorClass: ''
2832
}

0 commit comments

Comments
 (0)