Skip to content

Commit

Permalink
feat: added continuesPrior and continuesAfter props to Event component (
Browse files Browse the repository at this point in the history
jquense#1201)

* Added continuesPrior and continuesAfter props to Event component

* Added slot metrics to custom Events & EventWrappers
  • Loading branch information
Sarah authored and jquense committed Jul 5, 2019
1 parent ac945b7 commit 74a2233
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/EventCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class EventCell extends React.Component {
getters,
children,
components: { event: Event, eventWrapper: EventWrapper },
slotStart,
slotEnd,
...props
} = this.props

Expand All @@ -39,9 +41,13 @@ class EventCell extends React.Component {
{Event ? (
<Event
event={event}
continuesPrior={continuesPrior}
continuesAfter={continuesAfter}
title={title}
isAllDay={allDay}
localizer={localizer}
slotStart={slotStart}
slotEnd={slotEnd}
/>
) : (
title
Expand Down
4 changes: 3 additions & 1 deletion src/EventRowMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ export default {
onDoubleClick={onDoubleClick}
continuesPrior={continuesPrior}
continuesAfter={continuesAfter}
slotStart={slotMetrics.first}
slotEnd={slotMetrics.last}
selected={isSelected(event, selected)}
/>
)
},

renderSpan(slots, len, key, content = ' ') {
let per = Math.abs(len) / slots * 100 + '%'
let per = (Math.abs(len) / slots) * 100 + '%'

return (
<div
Expand Down
2 changes: 2 additions & 0 deletions src/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ class Popup extends React.Component {
onDoubleClick={onDoubleClick}
continuesPrior={dates.lt(accessors.end(event), slotStart, 'day')}
continuesAfter={dates.gte(accessors.start(event), slotEnd, 'day')}
slotStart={slotStart}
slotEnd={slotEnd}
selected={isSelected(event, selected)}
/>
))}
Expand Down

0 comments on commit 74a2233

Please sign in to comment.