'use client';

/** Code block — read-only syntax highlighting via `PrettyCode`. */

import { LazyPrettyCode } from '../../../../dev/code/PrettyCode/lazy';
import type { Language } from '../../../../dev/code/PrettyCode/lazy';
import type { CodeBlock } from '../../../types/block';
import type { BlockRendererProps } from './types';

export default function CodeBlockRenderer({ block, ctx }: BlockRendererProps<CodeBlock>) {
  const compact = ctx.appearance === 'compact';
  return (
    <LazyPrettyCode
      data={block.code}
      language={block.language as Language}
      isCompact={compact}
    />
  );
}
