finally fixed the css problem with the videocamera modal, now styling the simulation panel. There is a very weird bug with the slider on the left side of the header controller which is somehow visible when the modal is open, I will keep it for the end

This commit is contained in:
Fil Cesana 2020-05-09 09:57:04 +02:00
parent bf9919560a
commit c837a8156c
3 changed files with 112 additions and 58 deletions

View file

@ -69,6 +69,10 @@ export class MyHeader extends React.Component {
render() { render() {
return ( return (
<div> <div>
<SimulationPanel
simulationPanel={this.state.simulationPanel}
closeSimulationPanel={this.closeSimulationPanel}
/>
<Responsive minWidth={768}> <Responsive minWidth={768}>
<Grid columns="equal" divided inverted padded> <Grid columns="equal" divided inverted padded>
<Grid.Row color="black" textAlign="center"> <Grid.Row color="black" textAlign="center">
@ -83,10 +87,6 @@ export class MyHeader extends React.Component {
<div onClick={this.openSimulationPanel}> <div onClick={this.openSimulationPanel}>
<Button > Similuation Panel </Button> <Button > Similuation Panel </Button>
</div> </div>
<SimulationPanel
simulationPanel={this.state.simulationPanel}
closeSimulationPanel={this.closeSimulationPanel}
/>
</Grid.Row> </Grid.Row>
</Grid.Column> </Grid.Column>
<Grid.Column> <Grid.Column>
@ -143,22 +143,15 @@ export class MyHeader extends React.Component {
<Divider /> <Divider />
<Grid.Row> <Grid.Row>
<Button onClick={this.logout}>Logout</Button> <Button onClick={this.logout}>Logout</Button>
<Segment </Grid.Row>
compact
style={{
margin: "auto",
marginTop: "1em",
textAlign: "center",
}}
>
<Divider /> <Divider />
<Grid.Row>
<Checkbox <Checkbox
label={<label>Share cameras</label>} label={<label>Share cameras</label>}
checked={this.props.cameraEnabled} checked={this.props.cameraEnabled}
toggle toggle
onChange={(e, val) => this.setCameraEnabled(val.checked)} onChange={(e, val) => this.setCameraEnabled(val.checked)}
/> />
</Segment>
</Grid.Row> </Grid.Row>
</Grid.Column> </Grid.Column>
</Grid.Row> </Grid.Row>

View file

@ -1,41 +1,97 @@
import React from "react"; import React from "react";
import Modal from "react-modal"; import Modal from "react-modal";
import { Button } from "semantic-ui-react"; import {
Grid,
Divider,
Button,
Label,
Responsive,
Checkbox,
Image,
} from "semantic-ui-react";
const ReactModalPortal = { // const ReactModalPortal = {
opacity: 0 // opacity: 0
}; // };
const ReactModal__Overlay = { // const ReactModal__Overlay = {
alignItems: 'center', // background: 'black',
display: 'flex', // alignItems: 'center',
justifyContent: 'center', // display: 'flex',
transition: 'opacity 200ms ease-in-out' // justifyContent: 'center',
}; // transition: 'opacity 200ms ease-in-out'
// };
const modal = { // const modal = {
background: 'grey', // background: 'grey',
color: 'white', // color: 'white',
maxWidth: '2rem', // maxWidth: '2rem',
outline: 'none', // outline: 'none',
padding: '2rem', // padding: '2rem',
textAlign: 'center' // textAlign: 'center'
}; // };
const SimulationPanel = (props) => ( const SimulationPanel = (props) => (
<Modal <Modal
isOpen={!!props.simulationPanel} isOpen={!!props.simulationPanel}
contentLabel="Simulation Panel" contentLabel="Simulation Panel"
onRequestClose={props.closeSimulationPanel} onRequestClose={props.closeSimulationPanel}
style={ReactModalPortal,ReactModal__Overlay, modal} // style={ReactModalPortal,ReactModal__Overlay, modal}
style={{
overlay: {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(0,0,0,0.5)'
},
content: {
position: 'absolute',
top: '40px',
left: '40px',
right: '40px',
bottom: '40px',
border: '1px solid #ccc',
background: '#fff',
overflow: 'auto',
WebkitOverflowScrolling: 'touch',
borderRadius: '4px',
outline: 'none',
padding: '20px',
backgroundColor: 'black'
}
}}
> >
{props.simulationPanel && ( {props.simulationPanel}
<p> hey man </p> <Responsive minWidth={768}>
)} <Grid columns={3} divided inverted padded>
<Button fluid primary onClick={props.closeSimulationPanel}> <Grid.Row>
Exit <Grid.Column>
</Button> <Image src='https://react.semantic-ui.com/images/wireframe/media-paragraph.png' />
</Grid.Column>
<Grid.Column>
<Image src='https://react.semantic-ui.com/images/wireframe/media-paragraph.png' />
</Grid.Column>
<Grid.Column>
<Image src='https://react.semantic-ui.com/images/wireframe/media-paragraph.png' />
</Grid.Column>
</Grid.Row>
<Grid.Row>
<Grid.Column>
<Image src='https://react.semantic-ui.com/images/wireframe/media-paragraph.png' />
</Grid.Column>
<Grid.Column>
<Image src='https://react.semantic-ui.com/images/wireframe/media-paragraph.png' />
</Grid.Column>
<Grid.Column>
<Image src='https://react.semantic-ui.com/images/wireframe/media-paragraph.png' />
</Grid.Column>
</Grid.Row>
</Grid>
</Responsive>
</Modal> </Modal>
); );

View file

@ -1,37 +1,42 @@
import React from "react"; import React from "react";
import Modal from "react-modal"; import Modal from "react-modal";
import { Button } from "semantic-ui-react";
const modal = {
opacity: 0,
alignItems: "center",
display: "flex",
justifyContent: "center",
transition: "opacity 200ms ease-in-out",
background: "grey",
color: "white",
maxWidth: "2rem",
outline: "none",
padding: "2rem",
textAlign: "center",
maxHeight: "50vh",
};
const VideocamModal = (props) => ( const VideocamModal = (props) => (
<Modal <Modal
isOpen={!!props.selectedVideo} isOpen={!!props.selectedVideo}
contentLabel="Live Cam" contentLabel="Live Cam"
onRequestClose={props.closeModal} onRequestClose={props.closeModal}
style={modal} style={{
overlay: {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: 'rgba(0,0,0,0.5)'
},
content: {
position: 'absolute',
top: '40px',
left: '40px',
right: '40px',
bottom: '40px',
border: '1px solid #ccc',
background: '#fff',
overflow: 'auto',
WebkitOverflowScrolling: 'touch',
borderRadius: '4px',
outline: 'none',
padding: '20px',
backgroundColor: 'black'
}
}}
> >
{props.selectedVideo && ( {props.selectedVideo && (
<video autoPlay loop muted width="100%" height="90%"> <video autoPlay loop muted width="100%" height="90%">
<source src={props.url} type="video/mp4" /> <source src={props.url} type="video/mp4" />
</video> </video>
)} )}
<Button fluid primary onClick={props.closeModal}>
Close
</Button>
</Modal> </Modal>
); );