edit Timer (buttonbox component)

This commit is contained in:
Francesco Esposito 2019-03-21 11:22:41 +01:00
parent 5a9b4c9132
commit 637cc9b467
2 changed files with 15 additions and 52 deletions

View File

@ -13,11 +13,8 @@
box-shadow: 0 0 1px #161616, 0 0 10px rgb(133, 133, 133); box-shadow: 0 0 1px #161616, 0 0 10px rgb(133, 133, 133);
} }
.top-margin {
margin-top: 18px;
}
.buttons-box { .button-box {
background-color: rgba(255, 255, 255, 1.0); background-color: rgba(255, 255, 255, 1.0);
padding: 20px; padding: 20px;
margin-top: 5px; margin-top: 5px;

View File

@ -1,6 +1,7 @@
import React, { Component } from 'react'; import React, { Component } from 'react';
import { Button, Container, Row, Col } from 'reactstrap'; import { Container, Row, Col } from 'reactstrap';
import Notification from 'react-web-notification'; import Notification from 'react-web-notification';
import ButtonBox from './ButtonBox';
import './Timer.css'; import './Timer.css';
import logo from '../logo.svg'; import logo from '../logo.svg';
import sound from '../sound.mp3'; import sound from '../sound.mp3';
@ -121,6 +122,9 @@ class Timer extends Component {
this.setState({ seconds: this.seconds}); this.setState({ seconds: this.seconds});
} }
isStarted() {
return this.state.started;
}
render() { render() {
return ( return (
@ -146,54 +150,16 @@ class Timer extends Component {
</Col> </Col>
</Row> </Row>
<div className="buttons-box">
<Row> <Row>
<Col> <Col>
<Button <ButtonBox
className="buttons" startTimer = {this.startTimer}
block stopTimer = {this.stopTimer}
size="lg" isStarted = {this.state.started}
color="success" resetTimer = {this.resetTimer}
onClick={this.startTimer} />
disabled={this.state.started}
>
START
</Button>
</Col> </Col>
</Row> </Row>
<Row
className="top-margin"
>
<Col>
<Button
className="buttons"
block
color="danger"
size="lg"
onClick={this.stopTimer}
disabled={!this.state.started}
>
STOP
</Button>
</Col>
<Col>
<Button
className="buttons"
block
color="secondary"
size="lg"
onClick={this.resetTimer}
disabled={this.state.started || this.state.seconds === this.seconds}
>
RESET
</Button>
</Col>
</Row>
</div>
<Row>
</Row>
</Container> </Container>
<Notification <Notification