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

Add custom element to calendar #261

Open
valtism opened this issue Apr 23, 2020 · 7 comments
Open

Add custom element to calendar #261

valtism opened this issue Apr 23, 2020 · 7 comments
Assignees
Labels
enhancement New feature or request fresh

Comments

@valtism
Copy link

valtism commented Apr 23, 2020

Hi there!

Firstly, just want to say that I am loving this library, it's clear how much care and effort have been put into creating a great API.


I want to be able to add a clear selection button to the bottom of the calendar, seen in this design as "None"

image

I saw the closed issue about this wojtekmaj/react-calendar#167 where you said you weren't going to implement this, but also said "there are easy enough ways to add this button on your own if you need to".

I understand how to clear the input via controlled props, but how would I go about attaching my custom div to the bottom of the calendar?

@wojtekmaj
Copy link
Owner

I'd use a wrapper (a flex box, perhaps?) that holds both React-Calendar and the bar with the button you want to add :)

@wojtekmaj wojtekmaj self-assigned this Apr 23, 2020
@valtism
Copy link
Author

valtism commented Apr 23, 2020

I'm actually using react-date-picker (I should have posted this over there). That makes it tricky because the input lives in a td table cell, and the calendar pops out with absolute positioning. Both of the components, however, live inside a the single <DatePicker> component which means that if I add something to the bottom of a wrapper, the calendar no longer drops down.

What I wish I had is composable components, so that I could do something like:

<DatePicker>
  <div>
    <Calendar />
    <MyCloseButton />
  </div>
</DatePicker>

@wojtekmaj
Copy link
Owner

Oh shoot, yeah, that's an entirely different story. Let me move this ticket there.

I suppose we would need to add a method to render custom calendar or at least some things next to the calendar.

@wojtekmaj wojtekmaj transferred this issue from wojtekmaj/react-calendar Apr 23, 2020
@wojtekmaj wojtekmaj added enhancement New feature or request question Further information is requested labels Apr 23, 2020
@fabianallendorf
Copy link

fabianallendorf commented Nov 18, 2020

This would be a very interesting feature. I am facing a similar problems. I want to render presets, e.g. a button to "Last Month" or "Last Year" which automatically sets the desired dates. Is this feature still relevant?

@wojtekmaj
Copy link
Owner

Relevant? Yes. Coming soon? Unfortunately no way. Too busy as a new dad :)

@github-actions github-actions bot added the stale label Nov 29, 2021
@wojtekmaj wojtekmaj removed stale question Further information is requested labels Nov 30, 2021
@github-actions github-actions bot added the stale label Mar 7, 2022
@wojtekmaj wojtekmaj reopened this Mar 21, 2022
@wojtekmaj wojtekmaj added fresh and removed stale labels Mar 21, 2022
Repository owner deleted a comment from github-actions bot Mar 21, 2022
Repository owner deleted a comment from github-actions bot Mar 21, 2022
Repository owner deleted a comment from github-actions bot Mar 21, 2022
@lowcozy
Copy link

lowcozy commented Jul 20, 2022

do we have new update for this feature :(

@zapbampow
Copy link

I would also love this feature. I've had trouble getting local linking working with yarn to test out some ideas, but my guess is that something like adding new customCalendarHeader/customCalendarFooter props to be used in renderCalendar would work.

// in renderCalendar method
return portalContainer ? (
      createPortal(
        <div ref={this.calendarWrapper} className={classNames}>
          {customCalendarHeader}
          {calendar}
          {customCalendarFooter}
        </div>,
        portalContainer,
      )
    ) : (
      <Fit>
        <div
          ref={(ref) => {
            if (ref && !isOpen) {
              ref.removeAttribute('style');
            }
          }}
          className={classNames}
        >
          {customCalendarHeader}
          {calendar}
          {customCalendarFooter}
        </div>
      </Fit>
    );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fresh
Projects
None yet
Development

No branches or pull requests

5 participants