import React from 'react'; import type { AlertKind } from '../../types'; import { renderProseBody } from './proseBody'; interface AlertBlockProps { blockId: string; kind: AlertKind; body: string; onOpenLinkedDoc?: (path: string) => void; onOpenCodeFile?: (path: string) => void; imageBaseDir?: string; onImageClick?: (src: string, alt: string) => void; githubRepo?: string; onNavigateAnchor?: (hash: string) => void; } const TITLE: Record = { note: 'Note', tip: 'Tip', warning: 'Warning', caution: 'Caution', important: 'Important', }; const Icon: React.FC<{ kind: AlertKind }> = ({ kind }) => { const common = { viewBox: '0 0 16 16', width: '16', height: '16', fill: 'currentColor', 'aria-hidden': true as const }; switch (kind) { case 'note': return ; case 'tip': return ; case 'warning': return ; case 'caution': return ; case 'important': return ; } }; export const AlertBlock: React.FC = ({ blockId, kind, body, onOpenLinkedDoc, onOpenCodeFile, imageBaseDir, onImageClick, githubRepo, onNavigateAnchor, }) => { return (
{TITLE[kind]}
{renderProseBody({ body, imageBaseDir, onImageClick, onOpenLinkedDoc, onOpenCodeFile, onNavigateAnchor, githubRepo })}
); };