fixed calendar page

This commit is contained in:
Hope87 2021-06-23 13:17:59 +03:00
parent 5be414307b
commit b0ca345dbb
2 changed files with 11 additions and 4 deletions

View File

@ -35,20 +35,27 @@ const CalendarComponent = () => {
} }
function nextMonth() { function nextMonth() {
return value.clone().add(1, 'month'); return value.clone().subtract(2, 'month');
} }
const prevMonthFirst = () => {
return moment().subtract(1, 'month').format('MMMM');
};
const prevMonthSecond = () => {
return moment().subtract(2, 'month').format('MMMM');
};
return ( return (
<div className={style.CalendarComponent}> <div className={style.CalendarComponent}>
<div className={style.CalendarComponent__header}> <div className={style.CalendarComponent__header}>
<h3>Мои отчеты</h3> <h3>Мои отчеты</h3>
<div className={style.CalendarComponent__header__box}> <div className={style.CalendarComponent__header__box}>
<img src={ellipse} alt="" /> <img src={ellipse} alt="" />
<span onClick={() => setValue(prevMonth())}>Май</span> <span onClick={() => setValue(prevMonth())}>{prevMonthFirst()}</span>
</div> </div>
<div className={style.CalendarComponent__header__box}> <div className={style.CalendarComponent__header__box}>
<img src={ellipse} alt="" /> <img src={ellipse} alt="" />
<span onClick={() => setValue(nextMonth())}>Апрель</span> <span onClick={() => setValue(nextMonth())}>{prevMonthSecond()}</span>
</div> </div>
</div> </div>

View File

@ -51,7 +51,7 @@ const tabsList = [
}, },
]; ];
const Home = ({ onTestFunc }) => { const Home = () => {
const [tabs, setTabs] = useState([]); const [tabs, setTabs] = useState([]);
const [candidates, setCandidates] = useState([]); const [candidates, setCandidates] = useState([]);
const [tags, setTags] = useState([]); const [tags, setTags] = useState([]);