Skip to content

Commit

Permalink
fixup! Add showAllEvents Calendar Prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoangatl committed Dec 8, 2020
1 parent f54447d commit 19381cf
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/DateContentRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import * as dates from './utils/dates'
import BackgroundCells from './BackgroundCells'
import EventRow from './EventRow'
import EventEndingRow from './EventEndingRow'
import NoopWrapper from './NoopWrapper'
import ScrollableWeekWrapper from './ScrollableWeekWrapper'
import * as DateSlotMetrics from './utils/DateSlotMetrics'

class DateContentRow extends React.Component {
Expand Down Expand Up @@ -131,6 +133,9 @@ class DateContentRow extends React.Component {
let metrics = this.slotMetrics(this.props)
let { levels, extra } = metrics

let ScrollableWeekComponent = showAllEvents
? ScrollableWeekWrapper
: NoopWrapper
let WeekWrapper = components.weekWrapper

const eventRowProps = {
Expand Down Expand Up @@ -176,11 +181,7 @@ class DateContentRow extends React.Component {
{range.map(this.renderHeadingCell)}
</div>
)}
<div
className={clsx(
showAllEvents && 'rbc-row-content-scroll-container'
)}
>
<ScrollableWeekComponent>
<WeekWrapper isAllDay={isAllDay} {...eventRowProps}>
{levels.map((segs, idx) => (
<EventRow key={idx} segments={segs} {...eventRowProps} />
Expand All @@ -193,7 +194,7 @@ class DateContentRow extends React.Component {
/>
)}
</WeekWrapper>
</div>
</ScrollableWeekComponent>
</div>
</div>
)
Expand Down
7 changes: 7 additions & 0 deletions src/ScrollableWeekWrapper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from 'react'

const ScrollableWeekWrapper = ({ children }) => {
return <div className="rbc-row-content-scroll-container">{children}</div>
}

export default ScrollableWeekWrapper
9 changes: 9 additions & 0 deletions src/less/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,16 @@
height: 100%;

.rbc-row-content-scroll-container {
height: 100%;
overflow-y: scroll;

/* Hide scrollbar for Chrome, Safari and Opera */
&::-webkit-scrollbar {
display: none;
}

-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
}

Expand Down
11 changes: 10 additions & 1 deletion src/sass/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,16 @@
height: 100%;

.rbc-row-content-scroll-container {
height: 100%;
overflow-y: scroll;

/* Hide scrollbar for Chrome, Safari and Opera */
&::-webkit-scrollbar {
display: none;
}

-ms-overflow-style: none; /* IE and Edge */
scrollbar-width: none; /* Firefox */
}
}

Expand All @@ -98,4 +107,4 @@
@import './event';
@import './month';
@import './agenda';
@import './time-grid';
@import './time-grid';

0 comments on commit 19381cf

Please sign in to comment.