Files
old-roraccounting/client/src/homies/Flow.js

28 lines
702 B
JavaScript
Raw Normal View History

2020-09-19 04:46:01 +03:00
import React, { useState } from 'react';
import { withRouter } from 'react-router-dom';
import { Switch } from 'react-materialize';
2020-09-11 12:34:15 +03:00
import './Flow.css';
2020-09-19 04:46:01 +03:00
import CashFlow from "./CashFlow";
import WorkFlow from "./WorkFlow";
2020-09-11 12:34:15 +03:00
const Flow = (props) => {
2020-09-19 04:46:01 +03:00
const [flowType, setFlowType] = useState('cash');
2020-09-11 12:34:15 +03:00
2020-09-19 04:46:01 +03:00
return (
<div className="container">
<div className='switch-box'>
<Switch
offLabel="Cash"
onChange={(e) => setFlowType(e.target.checked === true ? 'work' : 'cash')}
onLabel="Work"
/>
2020-09-11 12:34:15 +03:00
</div>
2020-09-19 04:46:01 +03:00
{ flowType === 'cash' && <CashFlow /> }
{ flowType === 'work' && <WorkFlow /> }
2020-09-11 12:34:15 +03:00
</div>
);
}
export default withRouter(Flow);