refactor(consolidate): IconButton + Badge-solid + @layer base + Massen-Migration
E: app.css Base-h1–h6 in @layer base → text-*!-Hacks in Titeln entfernt. Neue Atoms: IconButton (runde Icon-Buttons), Badge solid-Variante + uppercase. Migrationen (6 parallele Pässe): - IconButton: 19 runde Nav/Close-Buttons (Carousel, Galleries, QuoteCarousel, PostOverview, Organisations, ImageModal). - Badge: Kategorie/Status-Pills (PostCard, BlogOverview, kalender, Comments, CalendarBlock, FilesBlock, SearchableText, Stellingnahme). - ui-Atome: Formular-Inputs (Comments, termin-melden, Stellingnahme) → TextInput/ Textarea/Checkbox/SearchField; dunkle NewsletterInline bewusst raw. - Button-Atom: ~20 inline Buttons in StellingnahmeGeneratorBlock. - Radius-Sweep: Cards→rounded-lg (viele via .card-surface), Buttons/Inputs→rounded-md, Chips→rounded-full; StrommixBlock/Calendar/Files/Adressbuch u.a. svelte-check 0 errors, voller Prod-Build grün. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<script lang="ts">
|
||||
/**
|
||||
* IconButton — runder Icon-only Button (Carousel-Pfeile, Modal-Close, …).
|
||||
* Die eine Quelle für kreisförmige Icon-Buttons. `label` = aria-label (Pflicht).
|
||||
* variant: surface (weiß, Border, Shadow — z.B. Slider-Pfeile) · ghost (transparent).
|
||||
*/
|
||||
import Icon from "@iconify/svelte";
|
||||
import "$lib/iconify-offline";
|
||||
|
||||
type Size = "sm" | "md";
|
||||
type Variant = "surface" | "ghost";
|
||||
|
||||
let {
|
||||
icon,
|
||||
label,
|
||||
href = undefined,
|
||||
onclick = undefined,
|
||||
size = "md",
|
||||
variant = "surface",
|
||||
disabled = false,
|
||||
class: className = "",
|
||||
...rest
|
||||
}: {
|
||||
icon: string;
|
||||
label: string;
|
||||
href?: string;
|
||||
onclick?: (e: MouseEvent) => void;
|
||||
size?: Size;
|
||||
variant?: Variant;
|
||||
disabled?: boolean;
|
||||
class?: string;
|
||||
[key: string]: unknown;
|
||||
} = $props();
|
||||
|
||||
const sizeClass: Record<Size, string> = { sm: "size-7", md: "size-9" };
|
||||
const iconClass: Record<Size, string> = { sm: "size-4", md: "size-5" };
|
||||
const variantClass: Record<Variant, string> = {
|
||||
surface:
|
||||
"border border-stein-200 bg-white text-stein-700 shadow-md hover:bg-stein-50",
|
||||
ghost: "text-stein-600 hover:bg-stein-100",
|
||||
};
|
||||
|
||||
const cls = $derived(
|
||||
`inline-flex shrink-0 items-center justify-center rounded-full transition-colors disabled:cursor-not-allowed disabled:opacity-50 ${sizeClass[size]} ${variantClass[variant]} ${className}`,
|
||||
);
|
||||
</script>
|
||||
|
||||
{#if href && !disabled}
|
||||
<a {href} class={cls} aria-label={label} {...rest}>
|
||||
<Icon icon={icon} class={iconClass[size]} aria-hidden="true" />
|
||||
</a>
|
||||
{:else}
|
||||
<button type="button" {disabled} {onclick} class={cls} aria-label={label} {...rest}>
|
||||
<Icon icon={icon} class={iconClass[size]} aria-hidden="true" />
|
||||
</button>
|
||||
{/if}
|
||||
Reference in New Issue
Block a user