mirror of
https://github.com/pure-css/pure.git
synced 2024-11-07 21:34:24 +00:00
18 lines
498 B
JavaScript
18 lines
498 B
JavaScript
|
import React from 'react';
|
||
|
import ReactDOMServer from 'react-dom/server';
|
||
|
import CodeBlock from './CodeBlock';
|
||
|
import { html } from 'js-beautify';
|
||
|
|
||
|
function Example({ children }) {
|
||
|
const opts = { inline: 'b' };
|
||
|
const markup = html(ReactDOMServer.renderToStaticMarkup(children), opts);
|
||
|
return (
|
||
|
<div className="example">
|
||
|
<div dangerouslySetInnerHTML={{ __html: markup }} />
|
||
|
<CodeBlock>{markup}</CodeBlock>
|
||
|
</div>
|
||
|
);
|
||
|
}
|
||
|
|
||
|
export default Example;
|