Skip to content

Commit

Permalink
feat(events): default events prop to an empty array (jquense#2161)
Browse files Browse the repository at this point in the history
Changes to default props to no longer make
events required, defaulting to an empty array

jquense#1708
  • Loading branch information
cutterbl authored Mar 24, 2022
1 parent 864f851 commit efac0b2
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
NODE_ENV=development npx lint-staged
4 changes: 3 additions & 1 deletion src/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,8 @@ class Calendar extends React.Component {
}

static defaultProps = {
events: [],
backgroundEvents: [],
elementProps: {},
popup: false,
toolbar: true,
Expand Down Expand Up @@ -981,7 +983,7 @@ class Calendar extends React.Component {
view,
toolbar,
events,
backgroundEvents = [],
backgroundEvents,
style,
className,
elementProps,
Expand Down
3 changes: 2 additions & 1 deletion stories/props/API.stories.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ Callback fired when the `view` value changes. When included it is used to 'contr

### events

- type: `arrayOf(Event)` **required**
- type: `arrayOf(Event)`
- default: `[]`
- <LinkTo kind="props" story="events">
Example
</LinkTo>
Expand Down
3 changes: 2 additions & 1 deletion stories/props/events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Canvas, Story } from '@storybook/addon-docs'

# events

- type: `arrayOf(Event)` **required**
- type: `arrayOf(Event)`
- default: `[]`

An array of event objects to display on the calendar. Events objects
can be any shape, as long as the Calendar knows how to retrieve the
Expand Down
2 changes: 1 addition & 1 deletion stories/props/events.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const Template = (args) => (
)

export const Events = Template.bind({})
Events.storyName = 'events *'
Events.storyName = 'events'
Events.args = {
defaultDate: new Date(2015, 3, 13),
events: demoEvents,
Expand Down

0 comments on commit efac0b2

Please sign in to comment.