-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: adds a new event id accessor (#2693)
if id is found, used as a react 'key', falls back to default
- Loading branch information
Showing
5 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Canvas, Story } from '@storybook/addon-docs' | ||
|
||
# eventIdAccessor | ||
|
||
- type: `string | number | function (event: Object) => string | number` | ||
- default: 'id' | ||
|
||
The id of the event. Must resolve to a string or number. Used as the key for the event in the DOM. If not provided, the event will be given a key of 'evt\_{index}'. | ||
|
||
<Story id="props--event-id-accessor" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from 'react' | ||
import { Calendar } from '../../src' | ||
import { accessorStoryArgs } from './storyDefaults' | ||
import mdx from './eventIdAccessor.mdx' | ||
|
||
export default { | ||
title: 'props', | ||
component: Calendar, | ||
argTypes: { | ||
localizer: { control: { type: null } }, | ||
events: { control: { type: null } }, | ||
defaultDate: { | ||
control: { | ||
type: null, | ||
}, | ||
}, | ||
}, | ||
parameters: { | ||
docs: { | ||
page: mdx, | ||
}, | ||
}, | ||
} | ||
|
||
const Template = (args) => ( | ||
<div className="height600"> | ||
<Calendar {...args} /> | ||
</div> | ||
) | ||
|
||
export const EventIdAccessor = Template.bind({}) | ||
EventIdAccessor.storyName = 'eventIdAccessor' | ||
EventIdAccessor.args = accessorStoryArgs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters