fix(site): add default file icon for files without specific icons (#21170)

This commit is contained in:
Atif Ali
2025-12-10 06:17:46 +00:00
committed by GitHub
parent cdb3ddcc2c
commit 46fd4aa03e
2 changed files with 14 additions and 1 deletions
@@ -8,8 +8,13 @@ const fileTree: FileTree = {
"main.tf": "resource aws_instance my_instance {}",
"variables.tf": "variable my_var {}",
"outputs.tf": "output my_output {}",
"README.md": "# Example\n\nThis is an example.",
"install.sh": "#!/bin/bash\necho 'Installing...'",
"config.txt": "key=value",
"app.py": "print('Hello')",
folder: {
"nested.tf": "resource aws_instance my_instance {}",
"data.csv": "col1,col2\n1,2",
},
};
@@ -3,7 +3,12 @@ import Menu from "@mui/material/Menu";
import MenuItem from "@mui/material/MenuItem";
import { SimpleTreeView, TreeItem } from "@mui/x-tree-view";
import { DockerIcon } from "components/Icons/DockerIcon";
import { ChevronDownIcon, ChevronRightIcon, FolderIcon } from "lucide-react";
import {
ChevronDownIcon,
ChevronRightIcon,
FileIcon,
FolderIcon,
} from "lucide-react";
import {
type CSSProperties,
type ElementType,
@@ -95,6 +100,9 @@ export const TemplateFileTree: FC<TemplateFilesTreeProps> = ({
icon = FileTypeMarkdown;
} else if (filename.endsWith("Dockerfile")) {
icon = DockerIcon;
} else {
// Default icon for files without a specific icon.
icon = FileIcon;
}
return (