Skip to content

Commit

Permalink
Update message props and use slot fallback
Browse files Browse the repository at this point in the history
Co-authored-by: Ross Edfort <[email protected]>
  • Loading branch information
laurakwhit and rossedfort committed Aug 13, 2024
1 parent 7d193ee commit 5e00bea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
37 changes: 17 additions & 20 deletions src/lib/holocene/table/paginated-table/api-paginated.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@
onSpace?: (event: KeyboardEvent) => void | undefined;
total?: string | number;
pageSizeSelectLabel: string;
emptyStateMessage: string;
fallbackErrorMessage: string;
emptyStateTitle?: string;
emptyStateMessage?: string;
errorTitle?: string;
errorMessage?: string;
itemsKeyname?: string;
previousButtonLabel: string;
nextButtonLabel: string;
Expand All @@ -49,8 +51,10 @@
export let total: string | number = '';
export let pageSizeSelectLabel: string;
export let emptyStateMessage: string;
export let fallbackErrorMessage: string;
export let emptyStateTitle = '';
export let emptyStateMessage = '';
export let errorTitle = '';
export let errorMessage = '';
export let itemsKeyname = 'items';
export let previousButtonLabel: string;
export let nextButtonLabel: string;
Expand Down Expand Up @@ -168,26 +172,19 @@

<svelte:fragment slot="empty">
{#if $store.loading}
{#if $$slots.loading}
<slot name="loading" />
{:else}
<slot name="loading">
<Loading />
{/if}
</slot>
{:else if error}
{#if $$slots.error}
<slot name="error" />
{:else}
<EmptyState title="">
<Alert
intent="error"
title={error?.message ?? fallbackErrorMessage}
/>
<slot name="error">
<EmptyState title={errorTitle}>
<Alert intent="error" title={error?.message ?? errorMessage} />
</EmptyState>
{/if}
{:else if $$slots.empty}
<slot name="empty" />
</slot>
{:else}
<EmptyState title="" content={emptyStateMessage} />
<slot name="empty">
<EmptyState title={emptyStateTitle} content={emptyStateMessage} />
</slot>
{/if}
</svelte:fragment>

Expand Down
2 changes: 1 addition & 1 deletion src/lib/pages/schedules.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
nextButtonLabel={translate('common.next')}
previousButtonLabel={translate('common.previous')}
emptyStateMessage={translate('schedules.empty-state-title')}
fallbackErrorMessage={translate('schedules.error-message-fetching')}
errorMessage={translate('schedules.error-message-fetching')}
>
<caption class="sr-only" slot="caption"
>{translate('common.schedules')}</caption
Expand Down

0 comments on commit 5e00bea

Please sign in to comment.