From 943ae6edbadb48ca866c256bcbbac7059356fdee Mon Sep 17 00:00:00 2001 From: Eugene Sokovikov Date: Wed, 15 Feb 2023 18:04:34 +0400 Subject: [PATCH] fix: pass dates to slotGroupPropGetter (#2066) Fixes an issue where you could not properly style slot groups --- src/Calendar.js | 2 +- src/TimeSlotGroup.js | 2 +- stories/props/API.stories.mdx | 2 +- stories/props/slotGroupPropGetter.mdx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Calendar.js b/src/Calendar.js index 5d7b7baa6..8a2cb6a28 100644 --- a/src/Calendar.js +++ b/src/Calendar.js @@ -569,7 +569,7 @@ class Calendar extends React.Component { * Optionally provide a function that returns an object of props to be applied * to the time-slot group node. Useful to dynamically change the sizing of time nodes. * ```js - * () => { style?: Object } + * (group: Date[]) => { style?: Object } * ``` */ slotGroupPropGetter: PropTypes.func, diff --git a/src/TimeSlotGroup.js b/src/TimeSlotGroup.js index 017a3bc24..80bd38009 100644 --- a/src/TimeSlotGroup.js +++ b/src/TimeSlotGroup.js @@ -14,7 +14,7 @@ export default class TimeSlotGroup extends Component { components: { timeSlotWrapper: Wrapper = BackgroundWrapper } = {}, } = this.props - const groupProps = getters ? getters.slotGroupProp() : {} + const groupProps = getters ? getters.slotGroupProp(group) : {} return (
{group.map((value, idx) => { diff --git a/stories/props/API.stories.mdx b/stories/props/API.stories.mdx index b7001d862..0a929136d 100644 --- a/stories/props/API.stories.mdx +++ b/stories/props/API.stories.mdx @@ -621,7 +621,7 @@ Optionally provide a function that returns an object of className or style props ### slotGroupPropGetter -- type: `function () => { style?: Object }` +- type: `function (group: Date[]) => { style?: Object }` - Example diff --git a/stories/props/slotGroupPropGetter.mdx b/stories/props/slotGroupPropGetter.mdx index f657d9551..dc354f2d1 100644 --- a/stories/props/slotGroupPropGetter.mdx +++ b/stories/props/slotGroupPropGetter.mdx @@ -3,7 +3,7 @@ import LinkTo from '@storybook/addon-links/react' # slotGroupPropGetter -- type: `function () => { style?: Object }` +- type: `function (group: Date[]) => { style?: Object }` Optionally provide a function that returns an object of className or style props to be applied to the time-slot node.