-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves UI issues when rendering a Kino.DataTable (#497)
Co-authored-by: Jonatan Kłosko <[email protected]>
- Loading branch information
1 parent
6d2a3ab
commit 02eeeb7
Showing
4 changed files
with
194 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Creates a loading skeleton for the data table | ||
*/ | ||
export function createTableSkeleton() { | ||
const container = document.createElement("div"); | ||
container.innerHTML = ` | ||
<div class="w-full"> | ||
<table class="w-full border-separate border-spacing-0 mt-2 animate-pulse"> | ||
<tbody> | ||
${createTableRow()} | ||
${createTableRow()} | ||
${createTableRow()} | ||
${createTableRow()} | ||
${createTableRow()} | ||
</tbody> | ||
</table> | ||
</div> | ||
`; | ||
return container; | ||
} | ||
|
||
function createTableRow() { | ||
return ` | ||
<tr> | ||
${createDataCell("w-12")} | ||
${createDataCell("w-32")} | ||
${createDataCell("w-48")} | ||
${createDataCell("w-20")} | ||
</tr> | ||
`; | ||
} | ||
|
||
function createDataCell(width) { | ||
return ` | ||
<td class="p-2.5 border-b border-slate-100 ${width}"> | ||
<div class="bg-gradient-to-r from-gray-100 via-gray-200 to-gray-100 h-4 rounded"> | ||
</div> | ||
</td> | ||
`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.