Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.0.11",
"version": "3.0.12-0",
"name": "@taikai/rocket-kit",
"author": "taikai",
"description": "TAIKAI Design System",
Expand Down
32 changes: 12 additions & 20 deletions src/molecules/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ const Table = <CellData extends CellBaseType>(props: TableProps<CellData>) => {
const hasActionMenu = actions.length > 0;
const validValues = values.filter(hasValue);
const hasValues = Array.isArray(values) && values.length > 0;

const headSkeleton = (
<th>
<Styles.SkeletonCell />
</th>
);

const cellSkeleton = (
<td>
<Styles.SkeletonCell />
</td>
);

const columnsSkeleton = columns.length > 0 ? columns.length : loadingColumns;

if (showEmpty && !hasValues) {
Expand All @@ -111,7 +98,11 @@ const Table = <CellData extends CellBaseType>(props: TableProps<CellData>) => {
<thead>
<tr>
{loading && !columns
? Array.from({ length: loadingColumns }, () => headSkeleton)
? Array.from({ length: loadingColumns }, (_, i) => (
<th key={`skeleton-head-${i}`}>
<Styles.SkeletonCell />
</th>
))
: columns.map(
({
id = '',
Expand All @@ -135,12 +126,13 @@ const Table = <CellData extends CellBaseType>(props: TableProps<CellData>) => {
</thead>
<tbody>
{loading
? Array.from({ length: loadingRows }, () => (
<tr>
{Array.from(
{ length: columnsSkeleton },
() => cellSkeleton
)}
? Array.from({ length: loadingRows }, (_, rowIndex) => (
<tr key={`skeleton-row-${rowIndex}`}>
{Array.from({ length: columnsSkeleton }, (_, colIndex) => (
<td key={`skeleton-cell-${rowIndex}-${colIndex}`}>
<Styles.SkeletonCell />
</td>
))}
</tr>
))
: validValues.map((row, index) => (
Expand Down