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 moment from "moment";
|
||||
import { getCalendarMonths, getMonthElements } from "../utils";
|
||||
|
||||
export const MonthsBody = ({selectedDate}) => {
|
||||
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'Jan', 'Feb', 'Mar', 'Apr'];
|
||||
|
||||
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>;
|
||||
export const MonthsBody = ({ selectedDate, setSelectedDate }) => {
|
||||
const months = getCalendarMonths(selectedDate);
|
||||
const monthsElements = getMonthElements(months, setSelectedDate);
|
||||
|
||||
return <MonthsContainer>{monthsElements}</MonthsContainer>;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user