'use client'; import classNames from 'classnames'; import { Highlight } from 'prism-react-renderer'; import * as React from 'react'; import { CopyCode } from './copy-code'; interface CodeProps { children: string; className?: string; language?: string; } const theme = { plain: { color: '#EDEDEF', fontSize: 13, fontFamily: 'CommitMono, monospace', }, styles: [ { types: ['comment'], style: { color: '#706F78', }, }, { types: ['atrule', 'keyword', 'attr-name', 'selector'], style: { color: '#7E7D86', }, }, { types: ['punctuation', 'operator'], style: { color: '#706F78', }, }, { types: ['class-name', 'function', 'tag', 'key-white'], style: { color: '#EDEDEF', }, }, ], }; export function Code({ children, className, language = 'html' }: CodeProps) { const value = children.trim(); return ( {({ tokens, getLineProps, getTokenProps }) => (
          

          
{tokens.map((line, i) => { return (
{line.map((token, key) => { const isException = token.content === 'from' && line[key + 1]?.content === ':'; const newTypes = isException ? [...token.types, 'key-white'] : token.types; token.types = newTypes; return ( ); })}
); })}
)}
); }