Skip to content

Commit 6171c41

Browse files
authored
Merge pull request #13118 from gitbutlerapp/update-icons
fix(ui): normalize button sizing and update icons
2 parents 258a056 + 181edee commit 6171c41

13 files changed

Lines changed: 43 additions & 39 deletions

File tree

apps/desktop/src/components/branch/BranchHeaderIcon.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</script>
1414

1515
<div class="stack__status--icon" style:--bg-color={color} class:small class:large>
16-
<Icon name={iconName} size={15} />
16+
<Icon name={iconName} size={14} />
1717
</div>
1818

1919
<style>

apps/desktop/src/components/commit/CommitListItem.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@
314314
position: relative;
315315
align-items: center;
316316
width: 100%;
317-
padding-right: 9px;
317+
padding-right: 11px;
318318
overflow: hidden;
319319
gap: 4px;
320320

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 & 28 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" ? 14 : 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}
@@ -229,17 +230,38 @@
229230
background: var(--btn-bg);
230231
color: var(--label-clr);
231232
cursor: pointer;
232-
233233
transition:
234234
background var(--transition-fast),
235235
opacity var(--transition-fast),
236236
color var(--transition-fast),
237237
max-width var(--transition-medium);
238238
user-select: none;
239239
240+
/* ---- Sizes ---- */
241+
&.tag-size {
242+
--btn-size: var(--size-tag);
243+
--btn-padding: 2px 6px;
244+
--btn-gap: 4px;
245+
}
246+
247+
&.button-size {
248+
--btn-size: var(--size-button);
249+
--btn-padding: 4px 8px;
250+
--btn-gap: 6px;
251+
}
252+
253+
&[class*="-size"] {
254+
height: var(--btn-size);
255+
padding: var(--btn-padding);
256+
gap: var(--btn-gap);
257+
}
258+
259+
&.fixed-width[class*="-size"] {
260+
width: var(--btn-size);
261+
}
262+
240263
/* ---- Child elements ---- */
241264
.btn-label {
242-
padding: 0 3px;
243265
overflow: hidden;
244266
white-space: nowrap;
245267
pointer-events: none;
@@ -382,29 +404,6 @@
382404
outline-offset: -2px;
383405
}
384406
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-
408407
/* ---- Dropdown split-button ---- */
409408
&.is-dropdown:first-of-type {
410409
flex: 1;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
data-testid={testId}
110110
aria-label="Open context menu"
111111
>
112-
<Icon name={icon} />
112+
<Icon name={icon} size={14} />
113113
</button>
114114
{:else}
115115
<Button

packages/ui/src/lib/components/segmentControl/Segment.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
2121
const context = getContext<SegmentContext>("SegmentControl");
2222
const selectedSegmentId = context.selectedSegmentId;
23+
const iconSize = $derived(context.size === "small" ? 14 : 16);
2324
2425
let elRef = $state<HTMLButtonElement>();
2526
let isFocused = $state(false);
@@ -67,7 +68,7 @@
6768
{/if}
6869
{#if icon}
6970
<span class="segment-control-item__icon" aria-hidden="true">
70-
<Icon name={icon} />
71+
<Icon name={icon} size={iconSize} />
7172
</span>
7273
{/if}
7374
</button>

packages/ui/src/lib/components/segmentControl/SegmentControl.svelte

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
3535
const context: SegmentContext = {
3636
selectedSegmentId,
37+
get size() {
38+
return size;
39+
},
3740
registerSegment: (id: string) => {
3841
if (!registeredSegments.includes(id)) {
3942
registeredSegments.push(id);

packages/ui/src/lib/components/segmentControl/segmentTypes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Writable } from "svelte/store";
22

33
export interface SegmentContext {
44
selectedSegmentId: Writable<string | undefined>;
5+
size: "default" | "small";
56
registerSegment(id: string): void;
67
selectSegment(id: string): void;
78
}
Lines changed: 1 addition & 1 deletion
Loading
Lines changed: 1 addition & 1 deletion
Loading

0 commit comments

Comments
 (0)