Skip to content

Commit

Permalink
- added comment to describe why displayName is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
tomjackking committed Oct 12, 2023
1 parent 34dfc37 commit a68dd14
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/ui/src/components/accordion/accordion.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ const meta: Meta<typeof Accordion> = {
tags: ['autodocs'],
decorators: [
(Story: StoryFn) => {
/**
* NOTE:
* Needed to change displayName here so subcomponent shows correct name in code view
* Could not change it on the component as Item from react-stately is used in three components
* and one displayName would overwrite the others
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Accordion.Item.displayName = 'Accordion.Item';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ const meta: Meta<typeof Autocomplete> = {
tags: ['autodocs'],
decorators: [
(Story: StoryFn) => {
/**
* NOTE:
* Needed to change displayName here so subcomponent shows correct name in code view
* Could not change it on the component as Item from react-stately is used in three components
* and one displayName would overwrite the others
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Autocomplete.Item.displayName = 'Autocomplete.Item';
Expand Down
6 changes: 6 additions & 0 deletions packages/ui/src/components/tabs/tabs.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ const meta: Meta<typeof Tabs> = {
tags: ['autodocs'],
decorators: [
(Story: StoryFn) => {
/**
* NOTE:
* Needed to change displayName here so subcomponent shows correct name in code view
* Could not change it on the component as Item from react-stately is used in three components
* and one displayName would overwrite the others
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
Tabs.Panel.displayName = 'Tabs.Panel';
Expand Down

0 comments on commit a68dd14

Please sign in to comment.