Skip to content

Commit

Permalink
Deprecate weekdayComponent and navbarComponent
Browse files Browse the repository at this point in the history
  • Loading branch information
gpbl committed Jun 30, 2016
1 parent b496b8c commit 75f375a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
| [locale](APIProps.md#locale) | en | `String` |
| [localeUtils](APIProps.md#localeutils) | | `Object` |
| [modifiers](APIProps.md#modifiers) | | `Object` |
| [navbarComponent](APIProps.md#navbarcomponent) | | `Component` |
| [navbarElement](APIProps.md#navbarelement) | | `Element` |
| [numberOfMonths](APIProps.md#numberofmonths) | 1 | `Number` |
| [onCaptionClick](APIProps.md#oncaptionclick) | | `(e: SyntethicEvent, currentMonth: Date) ⇒ void` |
| [onDayClick](APIProps.md#ondayclick) | | `(e: SyntethicEvent, day: Date, modifiers: Object) ⇒ void` |
Expand All @@ -31,4 +31,4 @@
| [selectedDays](APIProps.md#selecteddays) | | `Bool` |
| [tabIndex](APIProps.md#tabindex) | | `Number` |
| [toMonth](APIProps.md#tomonth) | | `Date` |
| [weekdayComponent](APIProps.md#weekdaycomponent) | | `Component` |
| [weekdayElement](APIProps.md#weekdayelement) | | `Element` |
40 changes: 36 additions & 4 deletions docs/APIProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ As default, the calendar includes `today` and `outside` modifiers. (_Outside_ ar

---

#### navbarComponent `Component`
#### <strike>navbarComponent</strike> `Component` <span style="color: red">deprecated</span>

> This prop has been deprecated in v2.3 and will be removed from v3.0. Please use `navbarElement` instead.
Custom component to render the navigation bar. It will receive the following props:

Expand All @@ -96,7 +98,24 @@ Custom component to render the navigation bar. It will receive the following pro
* localeUtils `Object`
* locale `String`

See [this example](http://www.gpbl.org/react-day-picker/examples?customComponents) or the [default](https://github.com/gpbl/react-day-picker/blob/master/src/Navbar.js) source code.
See [this example](http://www.gpbl.org/react-day-picker/examples?customElements) or the [default](https://github.com/gpbl/react-day-picker/blob/master/src/Navbar.js) source code.

---

#### navbarElement `Element`

Custom React element to render the navigation bar. It will receive the following props:

* className `String`
* previousMonth `Date`
* nextMonth `Date`
* showPreviousButton `Bool`
* showNextButton `Bool`
* onPreviousClick `() => void`
* onNextClick `() => void`
* dir `String`
* localeUtils `Object`
* locale `String`

---

Expand Down Expand Up @@ -142,7 +161,9 @@ The last allowed month. Users won't be able to navigate or interact with the day

---

#### weekdayComponent `Component`
#### <strike>weekdayComponent</strike> `Component` <span style="color: red">deprecated</span>

> This prop has been deprecated in v2.3 and will be removed from v3.0. Please use `navbarElement` instead.
Custom component to render the weekday cells in the header. It will receive the following props:

Expand All @@ -151,7 +172,18 @@ Custom component to render the weekday cells in the header. It will receive the
* localeUtils `Object`
* locale `String`

See [this example](http://www.gpbl.org/react-day-picker/examples?customComponents) or the [default](https://github.com/gpbl/react-day-picker/blob/master/src/Weekday.js) source code.
See [this example](http://www.gpbl.org/react-day-picker/examples?customElements) or the [default](https://github.com/gpbl/react-day-picker/blob/master/src/Weekday.js) source code.

---

#### weekdayElement `Element`

Custom React element to render the weekday cells in the header. It will receive the following props:

* weekday `Number`
* className `String`
* localeUtils `Object`
* locale `String`

## Event handlers

Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,5 +85,8 @@
"sinon": "1.17.4",
"sinon-chai": "2.8.0",
"webpack": "1.13.1"
},
"dependencies": {
"react-is-deprecated": "0.1.2"
}
}
6 changes: 3 additions & 3 deletions src/DayPicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { Component, PropTypes } from 'react';

import { deprecate } from 'react-is-deprecated';
import Caption from './Caption';
import Navbar from './Navbar';
import Month from './Month';
Expand Down Expand Up @@ -45,9 +45,9 @@ export default class DayPicker extends Component {
onCaptionClick: PropTypes.func,

renderDay: PropTypes.func,
weekdayComponent: PropTypes.func,
weekdayComponent: deprecate(PropTypes.func, 'react-day-picker: the `weekdayComponent` prop is deprecated from v2.3. Please pass a React element to the `weekdayElement` prop instead.'),
weekdayElement: PropTypes.element,
navbarComponent: PropTypes.func,
navbarComponent: deprecate(PropTypes.func, 'react-day-picker: the `navbarComponent` prop is deprecated from v2.3. Please pass a React element to the `navbarElement` prop instead.'),
navbarElement: PropTypes.element,

captionElement: PropTypes.element,
Expand Down

0 comments on commit 75f375a

Please sign in to comment.