Files
gpustack-ui/src/components/highlight-code/index.tsx
T
2024-08-23 18:33:23 +08:00

25 lines
633 B
TypeScript

import CodeViewerDark from './code-viewer-dark';
import CodeViewerLight from './code-viewer-light';
import './styles/index.less';
const HighlightCode: React.FC<{
code: string;
lang?: string;
copyable?: boolean;
theme?: 'light' | 'dark';
}> = (props) => {
const { code, lang = 'bash', copyable = true, theme = 'dark' } = props;
return (
<div className="high-light-wrapper">
{theme === 'dark' ? (
<CodeViewerDark lang={lang} code={code} copyable={copyable} />
) : (
<CodeViewerLight lang={lang} code={code} copyable={copyable} />
)}
</div>
);
};
export default HighlightCode;