Fix styles

This commit is contained in:
Adria Navarro 2024-02-08 16:51:16 +01:00
parent ce483e8c12
commit 207b7631ab
1 changed files with 20 additions and 14 deletions

View File

@ -7,20 +7,10 @@
export let maxRowsToDisplay = 5
let rowsToDisplay
$: {
rowsToDisplay = [
...cloneDeep(rows).slice(0, maxRowsToDisplay),
// { [Object.keys(schema)[0]]: "1" },
]
$: rowsToDisplay = [...cloneDeep(rows).slice(0, maxRowsToDisplay)]
$: additionalRows = rows.length - maxRowsToDisplay
if (rows.length - maxRowsToDisplay) {
rowsToDisplay.push({
[Object.keys(schema)[0]]: `...${
rows.length - maxRowsToDisplay
} further items`,
})
}
}
// Cast field in query preview response to number if specified by schema
$: {
for (let i = 0; i < rowsToDisplay.length; i++) {
@ -38,10 +28,26 @@
<div class="table">
<Table {schema} data={rowsToDisplay} allowEditing={false} />
{#if additionalRows > 0}
<div class="show-more">
...{additionalRows} further items
</div>
{/if}
</div>
<style>
.table :global(.spectrum-Table-cell) {
.table :global(.spectrum-Table-cell),
.show-more {
min-width: 100px;
}
.show-more {
display: flex;
padding: 16px;
justify-content: center;
background-color: var(--spectrum-global-color-gray-50);
border: 1px solid var(--spectrum-alias-border-color-mid);
border-top: 0;
}
</style>