mirror of
https://github.com/lissy93/networking-toolbox.git
synced 2026-11-28 08:15:02 +03:00
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>
30 lines
625 B
Svelte
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>
|