Open History to see the last commit
1import { SymbolView } from "../components/AppSymbol";
2import { Image, type ImageStyle, type StyleProp } from "react-native";
3
4import { markdownFileIconSource } from "@t3tools/mobile-markdown-text/file-icons";
5import { resolveMarkdownFileIcon } from "@t3tools/mobile-markdown-text/links";
6import { useThemeColor } from "../lib/useThemeColor";
7
8export function PierreEntryIcon(props: {
9 readonly path: string;
10 readonly kind: "file" | "directory";
11 readonly size?: number;
12 readonly style?: StyleProp<ImageStyle>;
13}) {
14 const size = props.size ?? 16;
15 const folderColor = useThemeColor("--color-icon-subtle");
16 if (props.kind === "directory") {
17 return <SymbolView name="folder" size={size} tintColor={folderColor} type="monochrome" />;
18 }
19
20 return (
21 <Image
22 source={markdownFileIconSource(resolveMarkdownFileIcon(props.path))}
23 resizeMode="contain"
24 style={[{ width: size, height: size }, props.style]}
25 />
26 );
27}