1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-23 02:36:11 +02:00
Files
csslayout/client/components/SampleCode.tsx
2019-11-27 21:23:51 +07:00

22 lines
510 B
TypeScript

import React from 'react';
import highlight from '../helpers/highlight';
interface SampleCodeProps {
code: string;
lang: string;
}
const SampleCode: React.FC<SampleCodeProps> = ({ code, lang }) => {
return code === ''
? <></>
: (
<pre
style={{ height: '100%', lineHeight: 1.5, margin: 0 }}
dangerouslySetInnerHTML={{ __html: highlight(code, lang) }}
/>
);
};
export default SampleCode;