UNPKG

@redocly/theme

Version:

Shared UI components lib

43 lines (34 loc) 1.84 kB
import type { IconProps } from '@redocly/theme/icons/types'; import { DocumentBlankIcon } from '@redocly/theme/icons/DocumentBlankIcon/DocumentBlankIcon'; import { DocumentYamlIcon } from '@redocly/theme/icons/DocumentYamlIcon/DocumentYamlIcon'; import { DocumentJsonIcon } from '@redocly/theme/icons/DocumentJsonIcon/DocumentJsonIcon'; import { DocumentJsIcon } from '@redocly/theme/icons/DocumentJsIcon/DocumentJsIcon'; import { DocumentTsIcon } from '@redocly/theme/icons/DocumentTsIcon/DocumentTsIcon'; import { DocumentCssIcon } from '@redocly/theme/icons/DocumentCssIcon/DocumentCssIcon'; import { DocumentHtmlIcon } from '@redocly/theme/icons/DocumentHtmlIcon/DocumentHtmlIcon'; import { DocumentReactIcon } from '@redocly/theme/icons/DocumentReactIcon/DocumentReactIcon'; import { DocumentMarkdownIcon } from '@redocly/theme/icons/DocumentMarkdownIcon/DocumentMarkdownIcon'; import { DocumentGraphqlIcon } from '@redocly/theme/icons/DocumentGraphqlIcon/DocumentGraphqlIcon'; import { DocumentPythonIcon } from '@redocly/theme/icons/DocumentPythonIcon/DocumentPythonIcon'; import { DocumentShellIcon } from '@redocly/theme/icons/DocumentShellIcon/DocumentShellIcon'; import { DocumentJavaIcon } from '@redocly/theme/icons/DocumentJavaIcon/DocumentJavaIcon'; const fileIconMap: Record<string, React.FunctionComponent<IconProps>> = { yaml: DocumentYamlIcon, yml: DocumentYamlIcon, json: DocumentJsonIcon, js: DocumentJsIcon, ts: DocumentTsIcon, css: DocumentCssIcon, html: DocumentHtmlIcon, jsx: DocumentReactIcon, tsx: DocumentReactIcon, md: DocumentMarkdownIcon, graphql: DocumentGraphqlIcon, gql: DocumentGraphqlIcon, py: DocumentPythonIcon, sh: DocumentShellIcon, java: DocumentJavaIcon, }; export function getFileIconByExt(ext: string) { return fileIconMap[ext] || DocumentBlankIcon; }