logic was moved to sepate functions
This commit is contained in:
parent
e38aed5433
commit
74e2d13e43
@ -1,18 +1,9 @@
|
|||||||
import { CurrentDateItem, DateItem, SecondaryDateItem } from "../styled-components";
|
|
||||||
import { MonthsContainer } from "../styled-components/MonthsContainer";
|
import { MonthsContainer } from "../styled-components/MonthsContainer";
|
||||||
import moment from "moment";
|
import { getCalendarMonths, getMonthElements } from "../utils";
|
||||||
|
|
||||||
export const MonthsBody = ({selectedDate}) => {
|
export const MonthsBody = ({ selectedDate, setSelectedDate }) => {
|
||||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr'];
|
const months = getCalendarMonths(selectedDate);
|
||||||
|
const monthsElements = getMonthElements(months, setSelectedDate);
|
||||||
console.log(`${selectedDate.year()}-${moment().month('Jan').format('M')}`)
|
|
||||||
|
|
||||||
const monthsElements = months.map(month => <DateItem big>{month}</DateItem>);
|
|
||||||
for(let i = 12; i < 16; i++) {
|
|
||||||
monthsElements[i] = <SecondaryDateItem big>{months[i]}</SecondaryDateItem>;
|
|
||||||
}
|
|
||||||
|
|
||||||
monthsElements[0] = <CurrentDateItem big>{months[0]}</CurrentDateItem>;
|
|
||||||
|
|
||||||
return <MonthsContainer>{monthsElements}</MonthsContainer>;
|
return <MonthsContainer>{monthsElements}</MonthsContainer>;
|
||||||
}
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user