fix: Hide info if requested

This commit is contained in:
Felix Rieseberg 2019-08-24 17:14:22 +02:00
parent 658fed75da
commit 51d0011ed0
2 changed files with 18 additions and 7 deletions

View file

@ -38,7 +38,7 @@ export class EmulatorInfo extends React.Component<
return (
<div id="status">
Disk: <span>{disk}</span>| CPU Speed: <span>{cpu}</span>|{" "}
Disk: <span>{disk}</span> | CPU Speed: <span>{cpu}</span> |{" "}
<a href="#" onClick={this.props.toggleInfo}>
Hide
</a>

View file

@ -216,12 +216,7 @@ export class Emulator extends React.Component<{}, EmulatorState> {
public render() {
return (
<>
<EmulatorInfo
emulator={this.state.emulator}
toggleInfo={() => {
this.setState({ isInfoDisplayed: !this.state.isInfoDisplayed });
}}
/>
{this.renderInfo()}
{this.renderUI()}
<div id="emulator">
<div></div>
@ -231,6 +226,22 @@ export class Emulator extends React.Component<{}, EmulatorState> {
);
}
/**
* Render the little info thingy
*/
public renderInfo() {
if (!this.state.isInfoDisplayed) {
return null;
}
return <EmulatorInfo
emulator={this.state.emulator}
toggleInfo={() => {
this.setState({ isInfoDisplayed: !this.state.isInfoDisplayed });
}}
/>
}
/**
* Boot the emulator without restoring state
*/