Skip to content

Commit

Permalink
Add timeGutterHeaderComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
danbovey committed Jun 13, 2018
1 parent b2aab5d commit 8a8e8ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions examples/demos/customView.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ let CustomView = () => (
defaultView="week"
defaultDate={new Date(2015, 3, 1)}
views={{ month: true, week: MyWeek }}
components={{
timeGutterHeader: <p>Custom gutter text</p>,
}}
/>
)

Expand Down
1 change: 1 addition & 0 deletions src/TimeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ export default class TimeGrid extends Component {
eventComponent={components.event}
eventWrapperComponent={components.eventWrapper}
dateCellWrapperComponent={components.dateCellWrapper}
timeGutterHeaderComponent={components.timeGutterHeader}
onSelectSlot={this.handleSelectAllDaySlot}
onSelectEvent={this.handleSelectAlldayEvent}
onDoubleClickEvent={this.props.onDoubleClickEvent}
Expand Down
6 changes: 5 additions & 1 deletion src/TimeGridHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class TimeGridHeader extends React.Component {
eventComponent: elementType,
eventWrapperComponent: elementType.isRequired,
dateCellWrapperComponent: elementType,
timeGutterHeaderComponent: elementType,

onSelectSlot: PropTypes.func,
onSelectEvent: PropTypes.func,
Expand Down Expand Up @@ -148,6 +149,7 @@ class TimeGridHeader extends React.Component {
eventComponent,
dateCellWrapperComponent,
eventWrapperComponent,
timeGutterHeaderComponent,
} = this.props

let style = {}
Expand All @@ -161,7 +163,9 @@ class TimeGridHeader extends React.Component {
style={style}
className={cn('rbc-time-header', isOverflowing && 'rbc-overflowing')}
>
<div className="rbc-label rbc-time-header-gutter" style={{ width }} />
<div className="rbc-label rbc-time-header-gutter" style={{ width }}>
{timeGutterHeaderComponent}
</div>

<div className="rbc-time-header-content">
<div className="rbc-row rbc-time-header-cell">
Expand Down

0 comments on commit 8a8e8ea

Please sign in to comment.