blob: 69423bf74898e12d8f6b58ac86e7813e450e83dd [file]
import 'package:jaspr/jaspr.dart';
import 'package:jaspr_content/components/file_icon.dart';
/// Builds a file icon SVG component for the given file name.
///
/// Uses the `file_tree_icons` package to resolve the appropriate icon SVG path data,
/// and applies a color class based on the file extension.
Component buildFileIcon(String fileName) {
final String colorClass;
if (fileName.endsWith('.dart')) {
colorClass = 'file-icon-dart';
} else if (fileName.endsWith('.yaml') || fileName.endsWith('.yml')) {
colorClass = 'file-icon-yaml';
} else {
colorClass = 'file-icon';
}
return FileIcon.forFile(
fileName,
classes: 'agent-changed-file-icon $colorClass',
attributes: {'aria-hidden': 'true'},
);
}