Renaming SVG to Render

This commit is contained in:
Jeff Avallone
2019-01-12 12:32:00 -05:00
parent 1336862bce
commit 8187865f1f
3 changed files with 8 additions and 5 deletions
+47
View File
@@ -0,0 +1,47 @@
import React from 'react';
import PlaceholderIcon from 'react-feather/dist/icons/file-text';
import style from './style.module.css';
import AppContext from 'components/AppContext';
class Render extends React.PureComponent {
static contextType = AppContext
svgContainer = React.createRef()
provideSVGData() {
if (!this.svgContainer.current) {
return;
}
const svg = this.svgContainer.current.querySelector('svg');
this.context.setSvgMarkup({
svg: svg.outerHTML,
width: svg.getAttribute('width'),
height: svg.getAttribute('height')
});
}
componentDidMount() {
this.provideSVGData();
}
componentDidUpdate() {
this.provideSVGData();
}
render() {
const { syntax, expr } = this.context;
console.log('Render:', syntax, expr); // eslint-disable-line no-console
// Demo rendering for now
return <div className={ style.render } ref={ this.svgContainer }>
<PlaceholderIcon />
</div>;
}
}
export default Render;