Skip to content

Commit

Permalink
Merge pull request #52 from Elizabethhub/fix-bug-calendar
Browse files Browse the repository at this point in the history
remove onClick func in ContentWrapperCalendar
  • Loading branch information
Elizabethhub authored Mar 18, 2024
2 parents 0910cce + ce998c9 commit 842cd75
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 9 additions & 4 deletions src/components/CalendarElement/CalendarElement.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,19 @@ const CalendarElement = () => {
const parent = element.parentNode;

if (parent.classList.contains('li-day')) {
console.log('show');
dispatch(changeShowDaysStats(true));
} else {
console.log('close');
dispatch(changeShowDaysStats(false));
}
}

const rootElement = document.getElementById('root');
rootElement.addEventListener('click', (event) => {
closeDayStat(event);
});

return (
<ContentWrapperCalendar onClick={() => closeDayStat(event)}>
<ContentWrapperCalendar>
<HeadingWrapper>
<MonthHeading>Month</MonthHeading>
<MonthSwitcher>
Expand All @@ -91,7 +94,9 @@ const CalendarElement = () => {
</HeadingWrapper>

<MonthList>
{showDaysStats && <DaysGeneralStats />}
{showDaysStats && (
<DaysGeneralStats monthData={monthData} currentDate={currentDate} />
)}
{monthData.map((item) => (
<DayStyles
key={item.day}
Expand Down
6 changes: 4 additions & 2 deletions src/components/DaysGeneralStats/DaysGeneralStats.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { DayStatsContainer, UpperElem } from './DaysGeneralStats.styled';

const DaysGeneralStats = () => {
const DaysGeneralStats = ({ monthData, currentDate }) => {
console.log('monthData: ', monthData);

return (
<DayStatsContainer>
<UpperElem>
<p>
<span>5, </span>
<span>Marth</span>
<span>{currentDate.toLocaleString('en-us', { month: 'long' })}</span>
</p>
</UpperElem>
<p>
Expand Down

0 comments on commit 842cd75

Please sign in to comment.