import classnames from 'classnames'; import Highlight, { defaultProps, Language } from 'prism-react-renderer'; import * as React from 'react'; interface CodeProps { children: any; className?: string; language?: Language; } const theme = { plain: { color: '#EDEDEF', fontSize: 13, fontFamily: 'MonoLisa, Menlo, 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 const Code: React.FC> = ({ children, className, language = 'html', ...props }) => { const [isCopied, setIsCopied] = React.useState(false); 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 ( ); })}
); })}
)}
); };