Before creating PR for a new I'd like to ask about your opinion first - maybe there is a better solution :-)
I'm trying to create custom toolbar with additional buttons:
const newToolbar = (props) => {
return (
<div className="rbc-toolbar">
<span className="rbc-btn-group">
... code handling standard buttons ...
</span>
<span className="rbc-btn-group">
<button type="button" onClick={()=>myButton1Handler()} > {'1'} </button>
<button type="button" onClick={()=>myButton2Handler()} > {'2'} </button>
</span>
</div>
)
}
Then in rendering Calendar component I'm looking for a way of sending additional props, e.g. handlers to my new buttons, to customized toolbar as current implementation does not seem to support anything like that.
<Calendar
components={ toolbar: newToolbar }
/>
Maybe something like this?
<Calendar
components={
toolbar:newToolbar,
toolbarProps: {onclick1:myButton1Handler, onclick2:myButton2Handler }
}
/>
Such toolbar props would be merged with props currently sent to toolbar component.
Right now I'm doing it by defining custom toolbar component within the scope of HOC encapsulating Calendar component, but it is not very nice solution.
Any idea?
try it like this
components = {
toolbar: props => (
<ToolBarView
{...props}
timesheetDate={timesheetDate}
/>
)
}
Yes, this works and is much nicer solution.
Thank you!
Most helpful comment
try it like this
components = { toolbar: props => ( <ToolBarView {...props} timesheetDate={timesheetDate} /> ) }