Skip to content

Commit d947a9b

Browse files
committed
🩹 Improve LineEdit based sidebar dialog item styling
1 parent f445256 commit d947a9b

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

src/svelteComponents/sidebarDialogItems/lineEdit.svelte

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@
88
label: string
99
description?: string
1010
value: string
11+
defaultValue?: string
1112
required?: boolean
1213
checkValue?: (value: string) => Promise<ValueCheckResult> | ValueCheckResult
1314
}
1415
15-
let { label, description, value = $bindable(), required, checkValue }: Props = $props()
16+
let {
17+
label,
18+
description,
19+
value = $bindable(),
20+
defaultValue,
21+
required,
22+
checkValue,
23+
}: Props = $props()
1624
1725
let error = $state<string | undefined>()
1826
let warning = $state<string | undefined>()
@@ -49,6 +57,10 @@
4957
warning = result.message
5058
}
5159
})
60+
61+
function resetValue() {
62+
value = defaultValue ?? ''
63+
}
5264
</script>
5365

5466
<BaseSidebarDialogItem {label} {description} {required} {error} {warning}>
@@ -59,6 +71,9 @@
5971
class="{error ? 'error' : ''} {warning ? 'warning' : ''}"
6072
bind:value
6173
/>
74+
{#if defaultValue !== undefined}
75+
<i class="fa fa-arrow-rotate-left" onclick={resetValue}></i>
76+
{/if}
6277
{/snippet}
6378
</BaseSidebarDialogItem>
6479

@@ -68,11 +83,23 @@
6883
background-color: var(--color-back);
6984
outline: 1px solid var(--color-border);
7085
padding-left: 4px;
86+
padding-right: 24px;
7187
7288
border-radius: 0;
7389
transition: outline 0.1s cubic-bezier(0.25, 0.68, 0.53, 1.3);
7490
}
7591
92+
i {
93+
position: absolute;
94+
right: 4px;
95+
top: 4px;
96+
cursor: pointer;
97+
}
98+
99+
i:hover {
100+
color: var(--color-light);
101+
}
102+
76103
.error {
77104
outline: 2px solid var(--color-error);
78105
}

src/svelteComponents/sidebarDialogItems/selectFile.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@
9696
background-color: var(--color-back);
9797
outline: 1px solid var(--color-border);
9898
padding-left: 4px;
99+
padding-right: 24px;
99100
100101
border-radius: 0;
101102
transition: outline 0.1s cubic-bezier(0.25, 0.68, 0.53, 1.3);

src/svelteComponents/sidebarDialogItems/selectFolder.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@
8080
background-color: var(--color-back);
8181
outline: 1px solid var(--color-border);
8282
padding-left: 4px;
83+
padding-right: 24px;
8384
8485
border-radius: 0;
8586
transition: outline 0.1s cubic-bezier(0.25, 0.68, 0.53, 1.3);

0 commit comments

Comments
 (0)