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

View File

@ -30,9 +30,10 @@ class Render extends React.PureComponent {
} }
render() { 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 // Demo rendering for now
return <div className={ style.render } ref={ this.svgContainer }> return <div className={ style.render } ref={ this.svgContainer }>
@ -42,7 +43,6 @@ class Render extends React.PureComponent {
} }
Render.propTypes = { Render.propTypes = {
syntax: PropTypes.string,
expr: PropTypes.string, expr: PropTypes.string,
onRender: PropTypes.func.isRequired 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;