1/**
2 * Syntax-highlighted blob rendering via `@pierre/diffs`' `<File>`.
3 *
4 * `React.lazy`-loaded from `Repo.tsx`'s BlobTab so the diffs+shiki
5 * runtime stays out of the initial bundle. The filename drives language
6 * detection (by extension); the built-in header is disabled — the tab
7 * keeps its own lines/bytes bar.
8 */
9import type { FileContents } from "@pierre/diffs";
10import { File } from "@pierre/diffs/react";
11import { useMemo } from "react";
12import { useFileOptions } from "../diff.tsx";
13
14const FileView = ({ name, text }: { name: string; text: string }) => {
15 const file = useMemo<FileContents>(
16 () => ({ name, contents: text }),
17 [name, text],
18 );
19 const options = useFileOptions();
20 return <File file={file} options={options} />;
21};
22
23export default FileView;