Skip to content

Commit

Permalink
[ALS-7781] Update error alert colors (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesPeck committed Nov 5, 2024
1 parent e621925 commit d6a8703
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/lib/components/ErrorAlert.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<script lang="ts">
export let title: string;
export let color: string = 'error';
</script>

<aside data-testid="error-alert" class="alert variant-filled-error">
<i class="fa-solid fa-triangle-exclamation text-4xl" aria-hidden="true"></i>
<aside data-testid="error-alert" class="alert variant-ghost-{color}">
<i class="fa-solid fa-circle-exclamation text-4xl" aria-hidden="true"></i>
<div class="alert-message">
<h3 class="h3 text-left">{title}</h3>
<slot />
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/explorer/Explorer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
</div>
</div>
{#if $error}
<ErrorAlert title="API Error">
<ErrorAlert title="Sorry, we could not retrieve your search results." color="secondary">
<p>{$error}</p>
</ErrorAlert>
{:else if $searchTerm || $selectedFacets.length > 0}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/explorer/FacetSideBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,7 @@
</Accordion>
{/if}
{:catch}
<ErrorAlert title="An error occured while retrieving facets." />
<ErrorAlert title="Something went wrong loading your search options." color="secondary">
<p>Please wait a moment, refresh the page, and try again.</p>
</ErrorAlert>
{/await}
4 changes: 3 additions & 1 deletion tests/routes/explorer/facets/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ test.describe('Facet Side Bar', () => {

await expect(facetSideBar).toBeVisible();
await expect(errorAlert).toBeVisible();
await expect(errorAlert).toHaveText('An error occured while retrieving facets.');
await expect(errorAlert).toHaveText(
'Something went wrong loading your search options. Please wait a moment, refresh the page, and try again.',
);
});
test('Facet Side Bar showes all categories', async ({ page }) => {
// Given
Expand Down

0 comments on commit d6a8703

Please sign in to comment.