-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
renderWeekDay property #172
Conversation
Thanks @stanislav-ermakov-roi, nice idea! 👍 I wonder if it wouldn't be better to pass a prop with a <Weekday weekday={ number } localeUtils={ object } locale={ string } /> then, when implementing the day picker, the developer would pass it via the new import DayPicker from 'react-day-picker';
import Weekday from './Weekday';
<DayPicker weekdayClass={ Weekday } /> In the DayPicker source code, we should write instead: <div key={i} className="DayPicker-Weekday">
- {renderWeekDay(i, locale, localeUtils)}
+ {React.createElement(this.props.weekdayClass, { weekday: i, locale, localeUtils })}
</div> I understand you wanted to keep the similarity to I was thinking to update that prop as well, e.g. passing a class: What do you think? |
@gpbl, I think your idea is good and is inline with architecture of 2nd version of the component. I also need similar functionality for Navbar, since I need custom labels for next and previous buttons. So another pull request is coming very soon. I can update this one with approach you suggested, since I would like this to be merged very soon, if it's possible. Regarding dayClass. Actually I would name this dayComponent, since class can be confused with className. Suggested idea could also be useful, but what if I just want to change cell content and not write all container props again? May be it's possible to update Day class to be able to extend it easily without the need to rewrite all the logic it contains already. But this should not be a problem if you keep renderDay prop. |
@stanislav-ermakov-roi awesome! Then, better discuss the implementation details first, as I feel bad asking to review a PR :) Would you mind to join the gitter room? |
I see, yes, it should work... must be clear we are passing a component class (
IMHO the component should not replace the container (e.g. that with I think as in my diff above, even |
Ok. I see your point. Going to rework this pull request. |
@stanislav-ermakov-roi nevermind, while chatting comes out it's better the opposite about the container thing :) |
c423057
to
cefbcb2
Compare
cefbcb2
to
638ae77
Compare
638ae77
to
fa59d1e
Compare
fa59d1e
to
226f3fd
Compare
Awesome thanks! Let me see why build fails then I'll merge :) |
The test was just bad written, my bad. Fixed! |
Adds new renderWeekDay property which should contain a function that renders weekday headers