diff --git a/src/components/CodeViewer.js b/src/components/CodeViewer.js index ac540f5..8477cc0 100644 --- a/src/components/CodeViewer.js +++ b/src/components/CodeViewer.js @@ -32,10 +32,10 @@ const AccordionSummary = withStyles((theme) => ({ root: { backgroundColor: theme.palette.secondary.main, borderBottom: `1px solid white`, - marginBottom: '-1px', - minHeight: '50px', + marginBottom: -1, + minHeight: 50, '&$expanded': { - minHeight: '50px', + minHeight: 50, }, }, content: { @@ -55,24 +55,15 @@ const AccordionDetails = withStyles((theme) => ({ class CodeViewer extends Component { - constructor(props){ - super(props); - this.state = { - expanded: true, - componentHeight: null - }; - this.myDiv = React.createRef(); + state = { + expanded: true } componentDidMount() { Prism.highlightAll(); - this.setState({componentHeight: this.myDiv.current.offsetHeight+'px'}); } - componentDidUpdate(props, state) { - if(this.myDiv.current && this.myDiv.current.offsetHeight+'px' !== this.state.componentHeight){ - this.setState({componentHeight: this.myDiv.current.offsetHeight+'px'}); - } + componentDidUpdate() { Prism.highlightAll(); } @@ -83,9 +74,8 @@ class CodeViewer extends Component { render() { var curlyBrackets = '{ }'; var unequal = '<>'; - console.log('render', this.myDiv); return ( - + {curlyBrackets}
Arduino Quellcode
- +
               
                 {this.props.arduino}
@@ -114,7 +104,7 @@ class CodeViewer extends Component {
             {unequal}
             
XML Blöcke
- +
               
                 {`${this.props.xml}`}