import * as React from 'react'; import './CodeBox.css'; import {Render} from '../../render/index'; import {Tabs} from '@native-ads/antd'; import {HighLight} from '../common/HighLight'; import classNames from 'classnames'; const TabPane = Tabs.TabPane; export interface CodeBoxPropsInterface { title: string; desc: string; code: string; language: string; mode?: string; } export class CodeBox extends React.Component { constructor(props: CodeBoxPropsInterface) { super(props); } render() { let classText = classNames({ [this.props.language]: true, 'codeblock-wrapper': true }); let renderZone; switch (this.props.language) { case 'json': renderZone = ; break; case '_raw_json': return ( {this.props.code.trim()} ); default: return ( {this.props.code.trim()} ); } return (
{renderZone}
{this.props.code.trim()}
); } }