import React, { useState } from 'react'; import { classNames } from 'primereact/utils'; import { CodeHighlight } from './templates/CodeHighlight'; const BlockViewer = (props) => { const [blockView, setBlockView] = useState('PREVIEW'); const copyCode = async (event) => { await navigator.clipboard.writeText(props.code); event.preventDefault(); }; return (
{props.header} {props.new && New}
{blockView === 'PREVIEW' && (
{props.children}
)} {blockView === 'CODE' && {props.code}}
); }; export default BlockViewer;