A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1import { KNOWN_PROVIDERS, type ProviderId } from '../lib/publish/providers';
2
3/**
4 * A small monochrome logo for a recognised foreign-publication provider (Leaflet, pckt,
5 * …). Renders nothing for an unrecognised provider, so callers can pass `provider`
6 * straight through. The glyph inherits `currentColor`; size it with the `size` prop.
7 *
8 * Shares its glyph + label data with the reader's `ProviderLogo.astro` via
9 * `lib/publish/providers` — the detection/asset core lives there, not in either renderer.
10 */
11export default function ProviderLogo( {
12 provider,
13 size = 14,
14 className,
15}: {
16 provider: ProviderId | null;
17 size?: number;
18 className?: string;
19} ) {
20 if ( ! provider ) {
21 return null;
22 }
23 // `body` is a hardcoded constant from our own registry (never user/PDS content), and
24 // `provider` is constrained to the ProviderId union — so this innerHTML is trusted.
25 const { label, viewBox, body } = KNOWN_PROVIDERS[ provider ];
26 return (
27 <svg
28 className={ className }
29 width={ size }
30 height={ size }
31 viewBox={ viewBox }
32 role="img"
33 aria-label={ label }
34 dangerouslySetInnerHTML={ { __html: body } }
35 />
36 );
37}