Loading syntax-specific rendering module

Still mocked out for testing
This commit is contained in:
Jeff Avallone 2019-01-13 11:44:57 -05:00
parent c3116bf5b6
commit 5de72ffb97
4 changed files with 14 additions and 5 deletions

View File

@ -58,7 +58,7 @@ class App extends React.PureComponent {
try {
const Render = await import(
/* webpackChunkName: "render-[index]" */
'components/Render' // TODO: Import syntax-specific render component
`syntax/${ syntax }`
);
// HACK: Fake loading time
@ -115,7 +115,6 @@ class App extends React.PureComponent {
};
const renderProps = {
onRender: this.handleSvg,
syntax,
expr
};

View File

@ -30,9 +30,10 @@ class Render extends React.PureComponent {
}
render() {
const { syntax, expr } = this.props;
const { expr } = this.props;
console.log('Render:', syntax, expr); // eslint-disable-line no-console
// eslint-disable-next-line no-console
console.log('Render:', this.constructor.name, expr);
// Demo rendering for now
return <div className={ style.render } ref={ this.svgContainer }>
@ -42,7 +43,6 @@ class Render extends React.PureComponent {
}
Render.propTypes = {
syntax: PropTypes.string,
expr: PropTypes.string,
onRender: PropTypes.func.isRequired
};

5
src/syntax/js.js Normal file
View File

@ -0,0 +1,5 @@
import Render from 'components/Render';
class RenderJS extends Render {}
export default RenderJS;

5
src/syntax/pcre.js Normal file
View File

@ -0,0 +1,5 @@
import Render from 'components/Render';
class RenderPCRE extends Render {}
export default RenderPCRE;