Skip to content

Commit

Permalink
[DateRangePicker] Fix props naming in DatePicker components (#25504)
Browse files Browse the repository at this point in the history
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
  • Loading branch information
callmeberzerker and oliviertassinari authored Mar 25, 2021
1 parent 4d78b49 commit d117947
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions docs/src/pages/components/date-picker/CustomDay.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export default function CustomDay() {
const classes = useStyles();
const [value, setValue] = React.useState(new Date());

const renderWeekPickerDay = (date, _selectedDates, PickersDayComponentProps) => {
const renderWeekPickerDay = (date, _selectedDates, pickersDayProps) => {
if (!value) {
return <PickersDay {...PickersDayComponentProps} />;
return <PickersDay {...pickersDayProps} />;
}

const start = startOfWeek(value);
Expand All @@ -48,7 +48,7 @@ export default function CustomDay() {

return (
<PickersDay
{...PickersDayComponentProps}
{...pickersDayProps}
disableMargin
className={clsx({
[classes.highlight]: dayIsBetween,
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/components/date-picker/CustomDay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export default function CustomDay() {
const renderWeekPickerDay = (
date: Date,
_selectedDates: Date[],
PickersDayComponentProps: PickersDayProps<Date>,
pickersDayProps: PickersDayProps<Date>,
) => {
if (!value) {
return <PickersDay {...PickersDayComponentProps} />;
return <PickersDay {...pickersDayProps} />;
}

const start = startOfWeek(value);
Expand All @@ -52,7 +52,7 @@ export default function CustomDay() {

return (
<PickersDay
{...PickersDayComponentProps}
{...pickersDayProps}
disableMargin
className={clsx({
[classes.highlight]: dayIsBetween,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ DateRangePicker.propTypes /* remove-proptypes */ = {
reduceAnimations: PropTypes.bool,
/**
* Custom renderer for `<DateRangePicker />` days. @DateIOType
* @example (date, DateRangePickerDayProps) => <DateRangePickerDay {...DateRangePickerDayProps} />
* @example (date, dateRangePickerDayProps) => <DateRangePickerDay {...dateRangePickerDayProps} />
*/
renderDay: PropTypes.func,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ export interface ExportedDesktopDateRangeCalendarProps<TDate> {
calendars?: 1 | 2 | 3;
/**
* Custom renderer for `<DateRangePicker />` days. @DateIOType
* @example (date, DateRangePickerDayProps) => <DateRangePickerDay {...DateRangePickerDayProps} />
* @example (date, dateRangePickerDayProps) => <DateRangePickerDay {...dateRangePickerDayProps} />
*/
renderDay?: (date: TDate, DateRangePickerDayProps: DateRangePickerDayProps<TDate>) => JSX.Element;
renderDay?: (date: TDate, dateRangePickerDayProps: DateRangePickerDayProps<TDate>) => JSX.Element;
}

interface DesktopDateRangeCalendarProps<TDate>
Expand Down
10 changes: 5 additions & 5 deletions packages/material-ui-lab/src/DayPicker/PickersCalendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export interface ExportedCalendarProps<TDate>
renderDay?: (
day: TDate,
selectedDates: Array<TDate | null>,
DayComponentProps: PickersDayProps<TDate>,
pickersDayProps: PickersDayProps<TDate>,
) => JSX.Element;
/**
* Component displaying when passed `loading` true.
Expand Down Expand Up @@ -176,7 +176,7 @@ function PickersCalendar<TDate>(props: PickersCalendarProps<TDate> & WithStyles<
{utils.getWeekArray(currentMonth).map((week) => (
<div role="row" key={`week-${week[0]}`} className={classes.week}>
{week.map((day) => {
const dayProps: PickersDayProps<TDate> = {
const pickersDayProps: PickersDayProps<TDate> = {
key: (day as any)?.toString(),
day,
isAnimating: isMonthSwitchingAnimating,
Expand All @@ -199,10 +199,10 @@ function PickersCalendar<TDate>(props: PickersCalendarProps<TDate> & WithStyles<
};

return renderDay ? (
renderDay(day, selectedDates, dayProps)
renderDay(day, selectedDates, pickersDayProps)
) : (
<div role="cell" key={dayProps.key}>
<PickersDay {...dayProps} />
<div role="cell" key={pickersDayProps.key}>
<PickersDay {...pickersDayProps} />
</div>
);
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ DesktopDateRangePicker.propTypes /* remove-proptypes */ = {
reduceAnimations: PropTypes.bool,
/**
* Custom renderer for `<DateRangePicker />` days. @DateIOType
* @example (date, DateRangePickerDayProps) => <DateRangePickerDay {...DateRangePickerDayProps} />
* @example (date, dateRangePickerDayProps) => <DateRangePickerDay {...dateRangePickerDayProps} />
*/
renderDay: PropTypes.func,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,8 @@ describe('<MobileDatePicker />', () => {
open
value={adapterToUse.date('2018-01-01T00:00:00.000')}
onChange={() => {}}
renderDay={(day, _selected, DayComponentProps) => (
<PickersDay {...DayComponentProps} data-testid="test-day" />
renderDay={(day, _selected, pickersDayProps) => (
<PickersDay {...pickersDayProps} data-testid="test-day" />
)}
/>,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ MobileDateRangePicker.propTypes /* remove-proptypes */ = {
reduceAnimations: PropTypes.bool,
/**
* Custom renderer for `<DateRangePicker />` days. @DateIOType
* @example (date, DateRangePickerDayProps) => <DateRangePickerDay {...DateRangePickerDayProps} />
* @example (date, dateRangePickerDayProps) => <DateRangePickerDay {...dateRangePickerDayProps} />
*/
renderDay: PropTypes.func,
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ StaticDateRangePicker.propTypes /* remove-proptypes */ = {
reduceAnimations: PropTypes.bool,
/**
* Custom renderer for `<DateRangePicker />` days. @DateIOType
* @example (date, DateRangePickerDayProps) => <DateRangePickerDay {...DateRangePickerDayProps} />
* @example (date, dateRangePickerDayProps) => <DateRangePickerDay {...dateRangePickerDayProps} />
*/
renderDay: PropTypes.func,
/**
Expand Down

0 comments on commit d117947

Please sign in to comment.