import { mutedDark, mutedLight } from '@/app/theme';
import { html, type Options } from '@/app/html';
import styles from './CodeBlock.module.scss';

type CodeBlockOptions = Options & {
    muted?: boolean;
    path?: string;
    isIndex?: boolean;
};

export function CodeBlock({ file, lang, themes, muted = false, path, isIndex }: CodeBlockOptions) {
    const code = html({
        file,
        lang,
        path,
        isIndex,
        themes: muted ? { light: mutedLight, dark: mutedDark } : themes,
    });

    return <div className={styles['code-block']} aria-hidden="true" dangerouslySetInnerHTML={{ __html: code }} />;
}
# Pages

[Home](/)
[Index](/index)
[Docs](/docs)