Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

PierreEntryIcon.tsx

25 lines829 Bytes

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";
6​
7export function PierreEntryIcon(props: {
8 readonly path: string;
9 readonly kind: "file" | "directory";
10 readonly size?: number;
11 readonly style?: StyleProp<ImageStyle>;
12}) {
13 const size = props.size ?? 16;
14 if (props.kind === "directory") {
15 return <SymbolView name="folder" size={size} tintColor="#a1a1aa" type="monochrome" />;
16 }
17​
18 return (
19 <Image
20 source={markdownFileIconSource(resolveMarkdownFileIcon(props.path))}
21 resizeMode="contain"
22 style={[{ width: size, height: size }, props.style]}
23 />
24 );