Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(components): showMore component customization #2537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

davidmh
Copy link

@davidmh davidmh commented Mar 13, 2024

I'm trying to render a custom component for the show more button. I know there are a few recommended ways to do this through the onShowMore callback and the messages.showMore prop as suggested in #1147.

But that doesn't cover all use cases. For example, I want to access the events that are being hidden by the show more button. I also want to render a custom popup right next to the show more button.

This new component adds the following props:

  • localizer
  • slot
  • slotDate
  • count
  • events
  • remainingEvents

I can also update the types once this gets merged.

Resolves #2391


I tried reaching out through the Slack community first, but the invitation link has expired, could you post a new link?

Comment on lines +88 to +95
action(
`custom showMore component clicked with props: ${JSON.stringify(
showMoreProps,
null,
2
)}`
)
}}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I passed the props in the action hoping to visualize the values in the actions panel, but the panel is not showing any actions at the moment, is it broken?

Screenshot 2024-03-13 at 15 48 10

@davidmh davidmh force-pushed the feature/show-more-customizations branch from a681825 to 2eea37e Compare March 14, 2024 00:35
I'm trying to render a custom component for the `show more` button. I
know there are a few recommended ways to do this through the `onShowMore`
callback and the `messages.showMore` prop as suggested in jquense#1147.

But that doesn't cover all use cases. For example, I want to access the
events that are being hidden by the `show more` button. I also want to
render a custom popup right next to the `show more` button.

Resolves jquense#2391
@davidmh davidmh force-pushed the feature/show-more-customizations branch from 2eea37e to 770be8b Compare March 14, 2024 03:44
return count ? (
<ShowMore
localizer={localizer}
slotDate={slotMetrics.getDateForSlot(slot - 1)}
Copy link
Author

@davidmh davidmh Mar 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getDateForSlot access the slots range, and array, using the slot as the index. But the slot received in this method are not zero-based, which means, we need to adjust for the expected zero-based index used to pull from the range:

getDateForSlot(slotNumber) {
return range[slotNumber]
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for mounting a custom "Show More" popup at a particular cell
1 participant