tomadoro/src/components/Box.js

73 lines
1.6 KiB
JavaScript
Raw Normal View History

import React from 'react';
2020-05-12 15:25:33 +02:00
import { Button, Row, Col, Card, CardBody } from 'reactstrap';
import PropTypes from 'prop-types';
2019-03-21 11:21:07 +01:00
const box = props => {
const buttonStyle = {
2020-05-12 15:25:33 +02:00
fontSize: '20px',
height: '54px',
borderRadius: '24px',
width: '100%',
margin: '4px 0px 4px 0px'
};
2019-03-21 11:21:07 +01:00
const boxStyle = {
2020-05-12 15:25:33 +02:00
padding: '2px',
borderRadius: '14px',
background: 'rgb(0,0,0, 0.4)'
};
2020-05-12 15:25:33 +02:00
return (
2020-05-12 15:25:33 +02:00
<Card style={boxStyle}>
<CardBody>
<Row>
2019-04-03 23:09:38 +02:00
<Col xs="12">
2019-03-21 11:21:07 +01:00
<Button
style={buttonStyle}
2019-03-21 11:21:07 +01:00
block
size="lg"
color="success"
onClick={props.startButton}
disabled={props.isStarted || props.seconds===0}>
2020-05-12 15:25:33 +02:00
Start
2019-03-21 11:21:07 +01:00
</Button>
</Col>
</Row>
2019-04-03 23:09:38 +02:00
<Row>
2019-04-16 12:53:26 +02:00
<Col xs="6">
2019-03-21 11:21:07 +01:00
<Button
style={buttonStyle}
2019-03-21 11:21:07 +01:00
color="danger"
size="lg"
onClick={props.stopButton}
disabled={!props.isStarted}>
2020-05-12 15:25:33 +02:00
Stop
2019-03-21 11:21:07 +01:00
</Button>
</Col>
2019-04-16 12:53:26 +02:00
<Col xs="6">
2019-03-21 11:21:07 +01:00
<Button
style={buttonStyle}
2019-03-21 11:21:07 +01:00
color="secondary"
size="lg"
onClick={props.resetButton}
disabled={props.isStarted}>
2020-05-12 15:25:33 +02:00
Reset
2019-03-21 11:21:07 +01:00
</Button>
</Col>
</Row>
2020-05-12 15:25:33 +02:00
</CardBody>
</Card>
);
}
box.propTypes = {
startButton: PropTypes.func.isRequired,
stopButton: PropTypes.func.isRequired,
resetButton: PropTypes.func.isRequired,
isStarted: PropTypes.bool.isRequired,
seconds: PropTypes.number.isRequired
};
export default box;