import React from 'react'; import { createHistory } from 'history'; import forms from './forms'; require("bootstrap/dist/css/bootstrap.css"); const history = createHistory(); export default class Examples extends React.Component { constructor(props) { super(props); this.handleHistoryChange = this.handleHistoryChange.bind(this); this.state = { selected: 'simple', }; } componentDidMount() { this.unlistenHistory = history.listen(this.handleHistoryChange); } componentWillUnmount() { this.unlistenHistory(); } handleHistoryChange({ hash }) { const fullPath = hash.replace('#', ''); const pth = fullPath.split('-'); if (pth && pth[0]) { this.setState({ selected: pth[pth.length - 1], },() => window.scrollTo(0, 0)); } } renderNavBarExamples() { const { selected } = this.state; return (
{ require('!raw!./forms/' + '/' + Component.name + '.js') }