import { Box, HStack, panda } from '@/styled-system/jsx' interface CodeBlockProps { title: string lang: CodeLang children: React.ReactNode [key: string]: any } export const CodeBlock = (props: CodeBlockProps) => { const { title, lang, children, ...rest } = props const extLang = title.split('.').pop() const resolvedLang = extLang !== lang ? extLang : lang return ( {resolvedLang && } {title} {children} ) } type CodeLang = | 'tsx' | 'ts' | 'js' | 'jsx' | 'css' | 'json' | 'astro' | 'html' | 'bash' | 'vue-html' | 'hbs' interface CodeLangIconProps { type: CodeLang | (string & {}) } const Svg = panda('svg', { base: { boxSize: '1em', fontSize: 'md' } }) const CodeLangIcon = (props: CodeLangIconProps) => { switch (props.type) { case 'tsx': case 'jsx': return ( ) case 'ts': return ( ) case 'js': return ( ) case 'css': return ( ) case 'json': return ( ) case 'astro': return ( ) case 'html': return ( ) case 'bash': return ( ) case 'vue': case 'vue-html': return ( ) case 'hbs': return ( ) default: return ( ) } }