react-bootstrap-table2/packages/react-bootstrap-table2-example/examples/common/codeBlock.js
ChunMing, Chen 82b827561d Enhancement/code prettify (#46)
* beautify code block with google-code-prettify

* prettyPrint when componentDidMount
* css style for code block

* skip rule 'no-unresolved' for eslint

* conflict with webpack resolve path

* refactor all code block in example folder with component <Code />

* refactor scss folder structure

* specify the responsibility for each stylesheet with file name

* load local color themes, tomorrow, for google code prettify

* re-select demo color and save into variable

* unify the color system for storybook
2017-09-03 00:31:58 -05:00

27 lines
636 B
JavaScript

import React, { Component } from 'react';
import PropTypes from 'prop-types';
export default class extends Component {
static propTypes = {
children: PropTypes.string
}
static defaultProps = {
children: ''
}
componentDidMount() {
// code-prettify
// run the PR.prettyPrint() function once your page has finished loading
if (typeof (PR) !== 'undefined') PR.prettyPrint(); // eslint-disable-line no-undef
}
render() {
return (
<div className="highlight-text-html-basic">
<pre className="prettyprint lang-js">
{ this.props.children }
</pre>
</div>
);
}
}