Files
immich/web/src/lib/components/ActionButton.svelte

17 lines
552 B
Svelte
Raw Normal View History

2025-11-10 15:49:02 -05:00
<script lang="ts">
2025-11-11 07:42:33 -05:00
import type { ActionItem } from '$lib/types';
import { IconButton, type IconButtonProps } from '@immich/ui';
2025-11-10 15:49:02 -05:00
type Props = {
2025-11-11 07:42:33 -05:00
action: ActionItem;
2025-11-10 15:49:02 -05:00
};
const { action }: Props = $props();
2025-11-11 07:42:33 -05:00
const { title, icon, color = 'secondary', props: other = {}, onSelect } = $derived(action);
const onclick = (event: Event) => onSelect?.({ event, item: action });
2025-11-10 15:49:02 -05:00
</script>
2025-11-11 07:42:33 -05:00
{#if action.$if?.() ?? true}
<IconButton variant="ghost" {color} shape="round" {...other as IconButtonProps} {icon} aria-label={title} {onclick} />
{/if}