Skip to content

Commit ed3bb76

Browse files
authored
feat(site): add icons for .sh, .json, and .y[a]ml files in template editor (#21171)
Added specific icons for common file types in the template file tree: - **.sh files**: TerminalIcon (terminal/shell scripts) - **.json files**: BracesIcon (JSON data files) - **.yaml/.yml files**: FileCodeIcon (YAML configuration files) <img width="260" height="290" alt="image" src="/api/flow.js?q=https%3A%2F%2Fgithub.com%2Fcoder%2Fcoder%2Fcommit%2F%253Ca%2520href%3D"https://github.com/user-attachments/assets/a470f4bc-fc2c-4e2d-8067-a9fbbfe32e42">https://github.com/user-attachments/assets/a470f4bc-fc2c-4e2d-8067-a9fbbfe32e42" /> These icons help users quickly identify file types at a glance in the template editor.
1 parent 05b02cf commit ed3bb76

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

site/src/modules/templates/TemplateFiles/TemplateFileTree.stories.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const fileTree: FileTree = {
1010
"outputs.tf": "output my_output {}",
1111
"README.md": "# Example\n\nThis is an example.",
1212
"install.sh": "#!/bin/bash\necho 'Installing...'",
13-
"config.txt": "key=value",
13+
"config.json": '{"name": "example"}',
14+
"docker-compose.yml": "version: '3'",
15+
Dockerfile: "FROM ubuntu:latest",
1416
"app.py": "print('Hello')",
1517
folder: {
1618
"nested.tf": "resource aws_instance my_instance {}",

site/src/modules/templates/TemplateFiles/TemplateFileTree.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,13 @@ import MenuItem from "@mui/material/MenuItem";
44
import { SimpleTreeView, TreeItem } from "@mui/x-tree-view";
55
import { DockerIcon } from "components/Icons/DockerIcon";
66
import {
7+
BracesIcon,
78
ChevronDownIcon,
89
ChevronRightIcon,
10+
FileCodeIcon,
911
FileIcon,
1012
FolderIcon,
13+
TerminalIcon,
1114
} from "lucide-react";
1215
import {
1316
type CSSProperties,
@@ -100,6 +103,12 @@ export const TemplateFileTree: FC<TemplateFilesTreeProps> = ({
100103
icon = FileTypeMarkdown;
101104
} else if (filename.endsWith("Dockerfile")) {
102105
icon = DockerIcon;
106+
} else if (filename.endsWith(".sh")) {
107+
icon = TerminalIcon;
108+
} else if (filename.endsWith(".json")) {
109+
icon = BracesIcon;
110+
} else if (filename.endsWith(".yaml") || filename.endsWith(".yml")) {
111+
icon = FileCodeIcon;
103112
} else {
104113
// Default icon for files without a specific icon.
105114
icon = FileIcon;

0 commit comments

Comments
 (0)