Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(events): default events prop to an empty array #2161

Merged
merged 1 commit into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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