diff options
author | Michael Foiani <sotech117@michaels-mbp-3.lan> | 2021-04-16 15:13:02 -0400 |
---|---|---|
committer | Michael Foiani <sotech117@michaels-mbp-3.lan> | 2021-04-16 15:13:02 -0400 |
commit | f00ac29dff86169e5dee9d816961cc13979f9a50 (patch) | |
tree | 024ac2af25a2f3119d0e1d13a8e31f099795a448 /maps-frontend/src/components/Route.js | |
parent | 505870f7a9f6f0ad8130cee3995d68b10010c24d (diff) |
Working on adapting maps frontend. Finished the time selector to change the time interval.
Diffstat (limited to 'maps-frontend/src/components/Route.js')
-rw-r--r-- | maps-frontend/src/components/Route.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/maps-frontend/src/components/Route.js b/maps-frontend/src/components/Route.js new file mode 100644 index 0000000..2a26fd9 --- /dev/null +++ b/maps-frontend/src/components/Route.js @@ -0,0 +1,44 @@ +// React/Component imports +import { useState } from "react"; +import DateSelector from './DateSelector.js'; + +// CSS imports +import '../css/Route.css'; + + +/** + * The component that hold the forms for routing. + * @param {Object} props + */ +function TimeSelector(props) { + const [current, setCurrent] = useState(""); + + const [startDate, setStartDate] = useState(props.dates.start); + const [endDate, setEndDate] = useState(props.dates.end); + + const changeTimeframe = () => { + props.setDates({ + start: startDate, + end: endDate + }) + } + + // The div with the html elements for routing. + return ( + <div className="Route"> + <div className="Coord-selectors-flex"> + <DateSelector side={"left"} name={"Start Date"} className="Coord-select-left" clickedFunc={props.setCurrent("start")} + changedFunc={setStartDate} disabled={props.currentSelector==='start' || props.isChanging}></DateSelector> + <div> + <h2>Adjust Timeframe :)</h2> + <button className="Btn Route-btn" onClick={() => changeTimeframe()} + disabled={props.currentSelector !== '' || props.isChanging}>Change Timeframe</button> + </div> + <DateSelector side={"right"} name={"End Date"} className="Coord-select-right" clickedFunc={props.setCurrent("end")} + changedFunc={setEndDate} disabled={props.currentSelector==='end' || props.isChanging}></DateSelector> + </div> + </div> + ); +} + +export default TimeSelector;
\ No newline at end of file |