This repository has been archived by the owner on May 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Things to be improved: *customize, add date filter headline, choose nicer colors. *check if it is correctly choosing the dates and etc. to filter (imo it looks like it is) *update max and min month limits (depending on oldest data available) *format in a nicer way on the navbar
- Loading branch information
Showing
5 changed files
with
177 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all" | ||
"trailingComma": "all", | ||
"endOfLine": "auto" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React, { useState } from 'react'; | ||
import DatePicker from 'react-datepicker'; | ||
|
||
interface Props { | ||
/** | ||
* date: date input | ||
* onStartChange: function taking argument "date" for Start Date | ||
* onEndChange: function taking argument "date" for End date | ||
*/ | ||
|
||
onStartChange: (date: any) => void; | ||
onEndChange: (date: any) => void; | ||
} | ||
|
||
/** | ||
* Component rendering Month Filter | ||
*/ | ||
|
||
const MonthFilter: React.FC<Props> = ({ onEndChange, onStartChange }) => { | ||
const [startDate, setStartDate] = useState(new Date('2022/06/08')); | ||
const [endDate, setEndDate] = useState(new Date()); | ||
|
||
return ( | ||
<> | ||
<DatePicker | ||
selected={startDate} | ||
onSelect={(date: any) => setStartDate(date)} | ||
onChange={onStartChange} | ||
selectsStart | ||
startDate={startDate} | ||
endDate={endDate} | ||
minDate={new Date('2022/06/08')} | ||
maxDate={new Date()} | ||
dateFormat="MM/yyyy" | ||
showMonthYearPicker | ||
/> | ||
<DatePicker | ||
selected={endDate} | ||
onSelect={(date: any) => setEndDate(date)} | ||
onChange={onEndChange} | ||
selectsEnd | ||
startDate={startDate} | ||
endDate={endDate} | ||
minDate={new Date('2022/06/08')} | ||
maxDate={new Date()} | ||
dateFormat="MM/yyyy" | ||
showMonthYearPicker | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default MonthFilter; |