Skip to content

Commit 15ce459

Browse files
committed
fix(ui): normalize button sizing and update icons
1 parent 222bcce commit 15ce459

4 files changed

Lines changed: 30 additions & 29 deletions

File tree

apps/desktop/src/components/views/AppSidebar.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@
398398
:global(.sidebar .btn-square) {
399399
aspect-ratio: 1 / 1;
400400
height: unset;
401+
padding: 0;
401402
border-radius: var(--radius-ml);
402403
/* codegen icon */
403404
--clr-codegen-star: currentColor;

packages/ui/src/lib/components/Button.svelte

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@
129129
]);
130130
131131
const displayHotkey = $derived(hotkey ? formatHotkeyForPlatform(hotkey) : undefined);
132+
const iconSize = $derived(size === "tag" ? 13 : 16);
132133
let tooltipInstance = $state<Tooltip>();
133134
134135
function onmousedown(e: MouseEvent) {
@@ -196,13 +197,13 @@
196197
{#if icon || loading || isDropdown}
197198
<div class={["btn-icon", iconClass]}>
198199
{#if loading}
199-
<Icon name="spinner" />
200+
<Icon name="spinner" size={iconSize} />
200201
{:else if isDropdown}
201202
<div class="btn-dropdown-chevron" class:open={dropdownOpen}>
202-
<Icon name="chevron-down" />
203+
<Icon name="chevron-down" size={iconSize} />
203204
</div>
204205
{:else if icon}
205-
<Icon name={icon} />
206+
<Icon name={icon} size={iconSize} />
206207
{/if}
207208
</div>
208209
{/if}
@@ -237,9 +238,31 @@
237238
max-width var(--transition-medium);
238239
user-select: none;
239240
241+
/* ---- Sizes ---- */
242+
&.tag-size {
243+
--btn-size: var(--size-tag);
244+
--btn-padding: 2px 8px;
245+
--btn-gap: 2px;
246+
}
247+
248+
&.button-size {
249+
--btn-size: var(--size-button);
250+
--btn-padding: 4px 10px;
251+
--btn-gap: 4px;
252+
}
253+
254+
&[class*="-size"] {
255+
height: var(--btn-size);
256+
padding: var(--btn-padding);
257+
gap: var(--btn-gap);
258+
}
259+
260+
&.fixed-width[class*="-size"] {
261+
width: var(--btn-size);
262+
}
263+
240264
/* ---- Child elements ---- */
241265
.btn-label {
242-
padding: 0 3px;
243266
overflow: hidden;
244267
white-space: nowrap;
245268
pointer-events: none;
@@ -382,29 +405,6 @@
382405
outline-offset: -2px;
383406
}
384407
385-
/* ---- Sizes ---- */
386-
&.tag-size {
387-
--btn-size: var(--size-tag);
388-
--btn-padding: 2px 4px;
389-
--btn-gap: 0;
390-
}
391-
392-
&.button-size {
393-
--btn-size: var(--size-button);
394-
--btn-padding: 4px 6px;
395-
--btn-gap: 2px;
396-
}
397-
398-
&[class*="-size"] {
399-
height: var(--btn-size);
400-
padding: var(--btn-padding);
401-
gap: var(--btn-gap);
402-
}
403-
404-
&.fixed-width[class*="-size"] {
405-
width: var(--btn-size);
406-
}
407-
408408
/* ---- Dropdown split-button ---- */
409409
&.is-dropdown:first-of-type {
410410
flex: 1;
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)