Skip to content

Commit

Permalink
Merge pull request #13769 from Budibase/add-icons-to-grid-buttons
Browse files Browse the repository at this point in the history
Add icons to grid buttons and simplify button column
  • Loading branch information
aptkingston authored May 28, 2024
2 parents 4eb12c4 + b7db5cb commit 55a418c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
1 change: 1 addition & 0 deletions packages/client/src/components/app/GridBlock.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
size: "M",
text: settings.text,
type: settings.type,
icon: settings.icon,
onClick: async row => {
// Create a fake, ephemeral context to run the buttons actions with
const id = get(component).id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,6 @@
})
</script>
<!-- Hidden copy of buttons to measure -->
<div class="measure" bind:this={measureContainer}>
<GridCell width="auto">
<div class="buttons">
{#each buttons as button}
<Button size="S">
{button.text || "Button"}
</Button>
{/each}
</div>
</GridCell>
</div>
<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
class="button-column"
Expand All @@ -72,6 +59,7 @@
class="row"
on:mouseenter={$isDragging ? null : () => ($hoveredRowId = row._id)}
on:mouseleave={$isDragging ? null : () => ($hoveredRowId = null)}
bind:this={measureContainer}
>
<GridCell
width="auto"
Expand All @@ -91,6 +79,9 @@
overBackground={button.type === "overBackground"}
on:click={() => handleClick(button, row)}
>
{#if button.icon}
<i class="{button.icon} S" />
{/if}
{button.text || "Button"}
</Button>
{/each}
Expand Down Expand Up @@ -130,16 +121,14 @@
gap: var(--cell-padding);
height: inherit;
}
.buttons :global(.spectrum-Button-Label) {
display: flex;
align-items: center;
gap: 4px;
}
/* Add left cell border */
.button-column :global(.cell) {
border-left: var(--cell-border);
}
/* Hidden copy of buttons to measure width against */
.measure {
position: absolute;
opacity: 0;
pointer-events: none;
}
</style>

0 comments on commit 55a418c

Please sign in to comment.