@pantheon-systems/design-toolkit-react
Version:
Pantheon's React Design Toolkit
29 lines (25 loc) • 750 B
JavaScript
import PropTypes from 'prop-types';
import CodeInline from './CodeInline.js';
import { jsx } from 'react/jsx-runtime';
var CodeBlock = function CodeBlock(_ref) {
var code = _ref.code,
language = _ref.language;
return /*#__PURE__*/jsx("pre", {
children: /*#__PURE__*/jsx(CodeInline, {
code: code,
language: language
})
});
};
CodeBlock.defaultProps = {
language: 'js'
};
// language types: if more are added, you must also adjust the babel config
// https://prismjs.com/#supported-languages
CodeBlock.propTypes = {
code: PropTypes.string.isRequired,
language: PropTypes.oneOf(['bash', 'css', 'html', 'js'])
};
var CodeBlock$1 = CodeBlock;
export { CodeBlock$1 as default };
//# sourceMappingURL=CodeBlock.js.map