feat: make InlineSvg more universal

This commit is contained in:
2026-04-01 20:34:37 +02:00
parent 320035c828
commit d9d87daf7e
2 changed files with 39 additions and 12 deletions

View File

@@ -1,17 +1,24 @@
--- ---
import type { SvgComponent } from "astro/types"; import type { HTMLAttributes, SvgComponent } from "astro/types";
interface Props { interface Props extends HTMLAttributes<"svg"> {
SvgComponent: SvgComponent; SvgComponent: SvgComponent;
size?: number; size?: number;
} }
const { size = 24, SvgComponent } = Astro.props; const {
SvgComponent,
height,
role = "presentation",
size = 24,
width,
...rest
} = Astro.props;
--- ---
<SvgComponent <SvgComponent
height={size} {...rest}
width={size} height={height ?? size}
fill="currentColor" {role}
role="presentation" width={width ?? size}
/> />

View File

@@ -38,7 +38,11 @@ import BaseLayout from "../layouts/BaseLayout.astro";
title="Mein Matrix-Konto" title="Mein Matrix-Konto"
external external
> >
<InlineSvg SvgComponent={MatrixLogo} slot="logo" /> <InlineSvg
SvgComponent={MatrixLogo}
fill="currentColor"
slot="logo"
/>
<span>@kmoschcau:matrix.org</span> <span>@kmoschcau:matrix.org</span>
</ButtonLink> </ButtonLink>
</li> </li>
@@ -49,7 +53,11 @@ import BaseLayout from "../layouts/BaseLayout.astro";
title="Mein GitHub-Konto" title="Mein GitHub-Konto"
external external
> >
<InlineSvg SvgComponent={GitHubLogo} slot="logo" /> <InlineSvg
SvgComponent={GitHubLogo}
fill="currentColor"
slot="logo"
/>
<span>kmoschcau</span> <span>kmoschcau</span>
</ButtonLink> </ButtonLink>
</li> </li>
@@ -60,7 +68,11 @@ import BaseLayout from "../layouts/BaseLayout.astro";
title="Mein GitLab-Konto" title="Mein GitLab-Konto"
external external
> >
<InlineSvg SvgComponent={GitLabLogo} slot="logo" /> <InlineSvg
SvgComponent={GitLabLogo}
fill="currentColor"
slot="logo"
/>
<span>kmoschcau</span> <span>kmoschcau</span>
</ButtonLink> </ButtonLink>
</li> </li>
@@ -71,7 +83,11 @@ import BaseLayout from "../layouts/BaseLayout.astro";
title="Mein LinkedIn-Konto" title="Mein LinkedIn-Konto"
external external
> >
<InlineSvg SvgComponent={LinkedInLogo} slot="logo" /> <InlineSvg
SvgComponent={LinkedInLogo}
fill="currentColor"
slot="logo"
/>
<span>kmoschcau</span> <span>kmoschcau</span>
</ButtonLink> </ButtonLink>
</li> </li>
@@ -82,7 +98,11 @@ import BaseLayout from "../layouts/BaseLayout.astro";
title="Mein Keyoxide-Eintrag" title="Mein Keyoxide-Eintrag"
external external
> >
<InlineSvg SvgComponent={KeyoxideLogo} slot="logo" /> <InlineSvg
SvgComponent={KeyoxideLogo}
fill="currentColor"
slot="logo"
/>
<span>Keyoxide</span> <span>Keyoxide</span>
</ButtonLink> </ButtonLink>
</li> </li>