Files
networking-toolbox/src/lib/components/common/ErrorCard.svelte
T
Alicia Sykesandliss-bot 6b3e440df2 Refactors diagnostic pages to use composables and shared components
Extracts common state management patterns into reusable composables:
- useDiagnosticState: Manages loading, results, and error states
- useClipboard: Handles copy-to-clipboard functionality
- useExamples: Manages example selection and state

Creates shared UI components to reduce duplication:
- ExamplesCard: Displays selectable examples with consistent styling
- ErrorCard: Standardized error message display
- ResultsCard: Consistent results presentation
- ActionButton: Reusable action buttons with loading states

Refactored 35+ diagnostic pages across DNS, HTTP, TLS, Email, and Network categories.
This improves code maintainability, reduces duplication, and ensures consistent UX.

Co-Authored-By: liss-bot <liss-bot@d0h.co>
2025-10-14 22:05:20 +01:00

30 lines
625 B
Svelte

<script lang="ts">
import Icon from '$lib/components/global/Icon.svelte';
interface Props {
title?: string;
error: string | null;
}
let { title = 'Error', error }: Props = $props();
</script>
{#if error}
<div class="card error-card">
<div class="card-content">
<div class="error-content">
<Icon name="alert-triangle" size="md" />
<div>
<strong>{title}</strong>
<p>{error}</p>
</div>
</div>
</div>
</div>
{/if}
<style>
/* Styles are already in diagnostics-pages.scss */
/* .error-card, .error-content are defined globally */
</style>