import * as React from 'react'; import { CDNIcon } from '@redocly/theme/icons/CDNIcon/CDNIcon'; // extension to icon name const fileIconMap: Record = { yaml: 'yaml', yml: 'yaml', json: 'json', js: 'javascript', ts: 'typescript', css: 'css', html: 'html', jsx: 'react', tsx: 'react', md: 'markdown', graphql: 'graphql', gql: 'graphql', py: 'python', sh: 'console', xsh: 'console', nu: 'console', java: 'java', ps: 'powershell', php: 'php_elephant', go: 'go', ruby: 'ruby', swift: 'swift', kotlin: 'kotlin', rust: 'rust', scala: 'scala', elixir: 'elixir', dart: 'dart', http: 'http', rest: 'http', c: 'c', h: 'c', hpp: 'c', cc: 'c', cpp: 'c', cxx: 'c', 'c++': 'c', sql: 'database', hbs: 'handlebars', cs: 'csharp', csx: 'csharp', csharp: 'csharp', markdoc: 'markdoc', mdoc: 'markdoc', mdx: 'mdx', }; // code block language to icon name, only for those when code extension is not available const languageIconMap: Record = { bash: 'console', python: 'python', java: 'java', graphql: 'graphql', javascript: 'javascript', typescript: 'typescript', react: 'react', markdown: 'markdown', php: 'php_elephant', ruby: 'ruby', swift: 'swift', kotlin: 'kotlin', rust: 'rust', scala: 'scala', elixir: 'elixir', dart: 'dart', csharp: 'csharp', objectivec: 'c', perl: 'perl', sql: 'database', xml: 'xml', vim: 'vim', lua: 'lua', zsh: 'console', fish: 'console', powershell: 'console', handlebars: 'handlebars', markdoc: 'markdoc', mdx: 'mdx', }; export function getFileIconByExt(ext: string) { const iconName = fileIconMap[ext] || 'document'; return ; } export function getFileIconByLanguage(language: string) { const iconName = fileIconMap[language] || languageIconMap[language] || 'document'; return ; }