+ {fileData?.size && isTooBig + ? `This file is too big (${formatBytes(fileData?.size)}), and cannot be previewed.` + : 'This file cannot be previewed.'} +
+ +
+ Cannot fetch "{filePath}" file content.
+
{filePath}
+ {children} +
+ {code}
+
+ );
+ }
+
+ return highlighter;
+}
diff --git a/components/Package/CodeBrowser/CodeBrowserFileRow.tsx b/components/Package/CodeBrowser/CodeBrowserFileRow.tsx
new file mode 100644
index 00000000..41e9a302
--- /dev/null
+++ b/components/Package/CodeBrowser/CodeBrowserFileRow.tsx
@@ -0,0 +1,79 @@
+import { useMemo, useState } from 'react';
+import { Pressable, View } from 'react-native';
+
+import { Label } from '~/common/styleguide';
+import { FileIcon, FolderIcon, WarningBlockquote } from '~/components/Icons';
+import Tooltip from '~/components/Tooltip';
+import { getFileWarning } from '~/util/codeBrowser';
+import tw from '~/util/tailwind';
+
+type Props = {
+ label: string;
+ depth?: number;
+ isActive?: boolean;
+ isDirectory?: boolean;
+ onPress?: () => void;
+};
+
+export default function CodeBrowserFileRow({
+ label,
+ depth = 0,
+ isActive = false,
+ isDirectory = false,
+ onPress,
+}: Props) {
+ const [isHovered, setIsHovered] = useState(false);
+ const warning = isDirectory ? undefined : getFileWarning(label);
+
+ const Icon = useMemo(() => (isDirectory ? FolderIcon : FileIcon), [isDirectory]);
+
+ const rowStyle = [
+ tw`flex flex-row items-center gap-1.5 px-3 py-1 last:mb-20`,
+ { paddingLeft: 12 + depth * 8 },
+ ];
+
+ const content = (
+ <>
+ Cannot fetch package bundle code.
} + {data && !isLoading && ( ++ Select file to preview from the list on the left. +
+