diff --git a/code/lib/types/src/modules/addons.ts b/code/lib/types/src/modules/addons.ts index 463c2c0e3b9..f55efcd2998 100644 --- a/code/lib/types/src/modules/addons.ts +++ b/code/lib/types/src/modules/addons.ts @@ -307,7 +307,11 @@ export type BaseStory = export interface Addon_RenderOptions { active: boolean; - key: string; + /** + * @deprecated You should not use key anymore as of Storybook 7.2 this render method is invoked as a React component. + * This property will be removed in 8.0. + * */ + key?: unknown; } /** diff --git a/code/ui/components/src/legacy/tabs/tabs.stories.tsx b/code/ui/components/src/legacy/tabs/tabs.stories.tsx index 77d357acf0b..cac0a76b4de 100644 --- a/code/ui/components/src/legacy/tabs/tabs.stories.tsx +++ b/code/ui/components/src/legacy/tabs/tabs.stories.tsx @@ -47,18 +47,12 @@ type Panels = Record>; const panels: Panels = { test1: { title: 'Tab title #1', - render: ({ active, key }) => - active ? ( -
- CONTENT 1 -
- ) : null, + render: ({ active }) => (active ?
CONTENT 1
: null), }, test2: { title: 'Tab title #2', - render: ({ active, key }) => ( + render: ({ active }) => (
+ render: ({ active }) => active ? ( -
+
{colours.map((colour, i) => (
- active ? ( -
- CONTENT 4 -
- ) : null, + render: ({ active }) => (active ?
CONTENT 4
: null), }, test5: { title: 'Tab title #5', - render: ({ active, key }) => - active ? ( -
- CONTENT 5 -
- ) : null, + render: ({ active }) => (active ?
CONTENT 5
: null), }, test6: { title: 'Tab title #6', - render: ({ active, key }) => ( -
CONTENT 6
} /> - ), + render: ({ active }) =>
CONTENT 6
} />, }, }; diff --git a/code/ui/manager/src/components/layout/app.mockdata.tsx b/code/ui/manager/src/components/layout/app.mockdata.tsx index 32b22148adf..1cb665508b7 100644 --- a/code/ui/manager/src/components/layout/app.mockdata.tsx +++ b/code/ui/manager/src/components/layout/app.mockdata.tsx @@ -42,22 +42,12 @@ export const panels: Addon_Collection = { test1: { title: 'Test 1', type: Addon_TypesEnum.PANEL, - render: ({ active, key }) => - active ? ( -
- TEST 1 -
- ) : null, + render: ({ active }) => (active ?
TEST 1
: null), }, test2: { title: 'Test 2', type: Addon_TypesEnum.PANEL, - render: ({ active, key }) => - active ? ( -
- TEST 2 -
- ) : null, + render: ({ active }) => (active ?
TEST 2
: null), }, }; diff --git a/code/ui/manager/src/components/panel/panel.stories.tsx b/code/ui/manager/src/components/panel/panel.stories.tsx index 9d29a9c07b9..6fe0f00f833 100644 --- a/code/ui/manager/src/components/panel/panel.stories.tsx +++ b/code/ui/manager/src/components/panel/panel.stories.tsx @@ -37,12 +37,7 @@ export const JSXTitles = () => { 'function-string': { type: Addon_TypesEnum.PANEL, title: () => 'Test 1', - render: ({ active, key }) => - active ? ( -
- TEST as string -
- ) : null, + render: ({ active }) => (active ?
TEST as string
: null), }, 'function-jsx': { type: Addon_TypesEnum.PANEL, @@ -54,12 +49,7 @@ export const JSXTitles = () => {
), - render: ({ active, key }) => - active ? ( -
- TEST with label -
- ) : null, + render: ({ active }) => (active ?
TEST with label
: null), }, 'function-jsx-icon': { type: Addon_TypesEnum.PANEL, @@ -71,12 +61,7 @@ export const JSXTitles = () => {
), - render: ({ active, key }) => - active ? ( -
- TEST with label -
- ) : null, + render: ({ active }) => (active ?
TEST with label
: null), }, 'function-jsx-state': { type: Addon_TypesEnum.PANEL, @@ -125,12 +110,8 @@ export const JSXTitles = () => {
); }, - render: ({ active, key }) => { - return active ? ( -
- TEST with timer -
- ) : null; + render: ({ active }) => { + return active ?
TEST with timer
: null; }, }, }}