Skip to content

Commit e5b66cb

Browse files
committed
Use button group instead of nesting buttons
1 parent f8ba423 commit e5b66cb

1 file changed

Lines changed: 21 additions & 24 deletions

File tree

frontend/viewer/src/lib/views/custom/ManageCustomViewsDialog.svelte

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import {useViewService} from '../view-service.svelte';
66
import {FW_CLASSIC_VIEW, FW_LITE_VIEW} from '../view-data';
77
import {Icon} from '$lib/components/ui/icon';
8+
import * as ButtonGroup from '$lib/components/ui/button-group';
89
import CreateCustomViewDialog from './CreateCustomViewDialog.svelte';
910
import EditCustomViewDialog from './EditCustomViewDialog.svelte';
1011
import {useDialogsService} from '$lib/services/dialogs-service';
@@ -67,33 +68,29 @@
6768
{#if customViews.length === 0}
6869
<p class="text-sm text-muted-foreground">{$t`No custom views yet.`}</p>
6970
{:else}
70-
<div class="rounded-md border divide-y">
71+
<div class="space-y-2">
7172
{#each customViews as view (view.id)}
72-
<button
73-
type="button"
74-
class="flex w-full items-center justify-between px-3 py-2 text-left hover:bg-muted cursor-pointer"
75-
onclick={() => openEdit(view)}
76-
>
77-
<div class="min-w-0">
78-
<div class="truncate text-sm font-medium">{view.name}</div>
79-
<div class="truncate text-xs text-muted-foreground">
80-
{$t`Based on ${view.base === ViewBase.FieldWorks ? FW_CLASSIC_VIEW.name : FW_LITE_VIEW.name}`}
73+
<ButtonGroup.Root class="w-full">
74+
<Button
75+
variant="outline"
76+
class="flex-1 text-start h-auto"
77+
onclick={() => openEdit(view)}
78+
>
79+
<div class="min-w-0 grow">
80+
<div class="truncate text-sm font-medium">{view.name}</div>
81+
<div class="truncate text-xs text-muted-foreground">
82+
{$t`Based on ${view.base === ViewBase.FieldWorks ? FW_CLASSIC_VIEW.name : FW_LITE_VIEW.name}`}
83+
</div>
8184
</div>
82-
</div>
83-
<div class="flex items-center gap-1">
84-
<Button
85-
size="icon"
86-
variant="ghost"
87-
class="hover:bg-destructive/20! hover:text-destructive"
88-
icon="i-mdi-trash-can-outline"
89-
onclick={(e: MouseEvent) => {
90-
e.stopPropagation();
91-
void onDelete(view);
92-
}}
93-
/>
9485
<Icon icon="i-mdi-chevron-right" class="text-muted-foreground" />
95-
</div>
96-
</button>
86+
</Button>
87+
<Button
88+
variant="outline"
89+
class="h-auto hover:bg-destructive/20! hover:text-destructive"
90+
icon="i-mdi-trash-can-outline"
91+
onclick={() => void onDelete(view)}
92+
/>
93+
</ButtonGroup.Root>
9794
{/each}
9895
</div>
9996
{/if}

0 commit comments

Comments
 (0)