Skip to content

Commit

Permalink
Fix CodeBlock element
Browse files Browse the repository at this point in the history
  • Loading branch information
brokenpylons committed Feb 13, 2024
1 parent ee6c513 commit 8ef3489
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 29 deletions.
42 changes: 13 additions & 29 deletions src/CodeBlock.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,20 @@ import React, {Component} from 'react';
import parser, {ParseError} from './lang/parser.js';
import BlocklyView from './BlocklyView.jsx';
import TextView from './TextView.jsx';
import injectSheet from 'react-jss';
import classes from './CodeBlock.module.css'

const style = {
container: {
display: 'flex',
flexFlow: 'row',
padding: '10px 0'
},
child: {
flex: '1 1 0',
outline: '1px solid gainsboro',
}
};

class CodeBlock extends Component {
render() {
const {classes} = this.props;

const ast = parser.parse(this.props.literal);
return (
<div className={classes.container}>
<div className={classes.child}>
<TextView ast={ast} />
</div>
<div className={classes.child}>
<BlocklyView ast={ast} />
</div>
function CodeBlock({literal}) {
const ast = parser.parse(literal);
return (
<div className={classes.container}>
<div className={classes.child}>
<TextView ast={ast} />
</div>
<div className={classes.child}>
<BlocklyView ast={ast} />
</div>
);
}
</div>
);
}

export default injectSheet(style)(CodeBlock);
export default CodeBlock;
10 changes: 10 additions & 0 deletions src/CodeBlock.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.container {
display: flex;
flex-flow: row;
padding: 10px 0;
}

.child {
flex: 1 1 0;
outline: 1px solid gainsboro;
}

0 comments on commit 8ef3489

Please sign in to comment.