1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-07 14:46:38 +02:00
Files
csslayout/client/components/SampleCode.tsx
Phuoc Nguyen e1b4c6efa2 Tweak colors
2021-04-01 16:04:59 +07:00

28 lines
700 B
TypeScript

/**
* A collection of popular layouts and patterns made with CSS (https://csslayout.io)
* (c) 2019 - 2021 Nguyen Huu Phuoc <https://twitter.com/nghuuphuoc>
*/
import * as React from 'react';
import highlight from '../helpers/highlight';
interface SampleCodeProps {
code: string;
fullHeight?: boolean;
lang: string;
}
const SampleCode: React.FC<SampleCodeProps> = ({ code, fullHeight = false, lang }) => {
return code === ''
? <></>
: (
<pre
className={`language-${lang}`}
dangerouslySetInnerHTML={{ __html: highlight(code, lang) }}
/>
);
};
export default SampleCode;