code on/off
This commit is contained in:
parent
cacde16ab2
commit
393c89877e
@ -7,7 +7,7 @@ class CodeViewer extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div style={{height: '500px', border: '1px solid black'}}>
|
||||||
{this.props.arduino}
|
{this.props.arduino}
|
||||||
<p>{this.props.xml}</p>
|
<p>{this.props.xml}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,23 +3,40 @@ import React, { Component } from 'react';
|
|||||||
import WorkspaceStats from './WorkspaceStats';
|
import WorkspaceStats from './WorkspaceStats';
|
||||||
import WorkspaceFunc from './WorkspaceFunc';
|
import WorkspaceFunc from './WorkspaceFunc';
|
||||||
import BlocklyWindow from './Blockly/BlocklyWindow';
|
import BlocklyWindow from './Blockly/BlocklyWindow';
|
||||||
|
import CodeViewer from './CodeViewer';
|
||||||
|
|
||||||
import Grid from '@material-ui/core/Grid';
|
import Grid from '@material-ui/core/Grid';
|
||||||
|
import FormControlLabel from '@material-ui/core/FormControlLabel';
|
||||||
|
import Switch from '@material-ui/core/Switch';
|
||||||
|
|
||||||
class Home extends Component {
|
class Home extends Component {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
codeOn: false
|
||||||
|
}
|
||||||
|
|
||||||
|
onChange = () => {
|
||||||
|
this.setState({ codeOn: !this.state.codeOn });
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<WorkspaceStats />
|
<WorkspaceStats />
|
||||||
<Grid container spacing={2}>
|
<Grid container spacing={2}>
|
||||||
<Grid item xs={12} md={6}>
|
<Grid item xs={12} md={this.state.codeOn ? 6 : 12} style={{position: 'relative'}}>
|
||||||
|
<FormControlLabel
|
||||||
|
style={{margin: '5px 10px 0 0', position: 'absolute', top: 0, right:0, zIndex:1}}
|
||||||
|
control={<Switch checked={this.state.codeOn} onChange={this.onChange} color='primary'/>}
|
||||||
|
label="Code"
|
||||||
|
/>
|
||||||
<BlocklyWindow />
|
<BlocklyWindow />
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item xs={12} md={6}>
|
{this.state.codeOn ?
|
||||||
<div style={{height: '500px', border: '1px solid black'}}></div>
|
<Grid item xs={12} md={6}>
|
||||||
</Grid>
|
<CodeViewer/>
|
||||||
|
</Grid>
|
||||||
|
: null}
|
||||||
</Grid>
|
</Grid>
|
||||||
<WorkspaceFunc />
|
<WorkspaceFunc />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user