[Package][Expandable flyout] - fix Storybook (#185036)

This commit is contained in:
Philippe Oberti 2024-06-11 21:27:45 -05:00 committed by GitHub
parent e767ef47d3
commit 2ae94e8ad0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 67 additions and 47 deletions

View file

@ -101,13 +101,17 @@ const registeredPanels = [
];
export const Right: Story<void> = () => {
const state = {
right: {
id: 'right',
const state: State = {
byId: {
memory: {
right: {
id: 'right',
},
left: undefined,
preview: undefined,
},
},
left: {},
preview: [],
} as unknown as State;
};
return (
<TestProvider state={state}>
@ -117,15 +121,19 @@ export const Right: Story<void> = () => {
};
export const Left: Story<void> = () => {
const state = {
right: {
id: 'right',
const state: State = {
byId: {
memory: {
right: {
id: 'right',
},
left: {
id: 'left',
},
preview: undefined,
},
},
left: {
id: 'left',
},
preview: [],
} as unknown as State;
};
return (
<TestProvider state={state}>
@ -135,19 +143,23 @@ export const Left: Story<void> = () => {
};
export const Preview: Story<void> = () => {
const state = {
right: {
id: 'right',
},
left: {
id: 'left',
},
preview: [
{
id: 'preview1',
const state: State = {
byId: {
memory: {
right: {
id: 'right',
},
left: {
id: 'left',
},
preview: [
{
id: 'preview1',
},
],
},
],
} as unknown as State;
},
};
return (
<TestProvider state={state}>
@ -157,22 +169,26 @@ export const Preview: Story<void> = () => {
};
export const MultiplePreviews: Story<void> = () => {
const state = {
right: {
id: 'right',
},
left: {
id: 'left',
},
preview: [
{
id: 'preview1',
const state: State = {
byId: {
memory: {
right: {
id: 'right',
},
left: {
id: 'left',
},
preview: [
{
id: 'preview1',
},
{
id: 'preview2',
},
],
},
{
id: 'preview2',
},
],
} as unknown as State;
},
};
return (
<TestProvider state={state}>

View file

@ -9,6 +9,7 @@
import { Provider as ReduxProvider } from 'react-redux';
import { configureStore } from '@reduxjs/toolkit';
import React, { FC, PropsWithChildren } from 'react';
import { I18nProvider } from '@kbn/i18n-react';
import { ExpandableFlyoutContextProvider } from '../context';
import { reducer } from '../reducer';
import { Context } from '../redux';
@ -32,10 +33,12 @@ export const TestProvider: FC<PropsWithChildren<TestProviderProps>> = ({
});
return (
<ExpandableFlyoutContextProvider urlKey={urlKey}>
<ReduxProvider store={store} context={Context}>
{children}
</ReduxProvider>
</ExpandableFlyoutContextProvider>
<I18nProvider>
<ExpandableFlyoutContextProvider urlKey={urlKey}>
<ReduxProvider store={store} context={Context}>
{children}
</ReduxProvider>
</ExpandableFlyoutContextProvider>
</I18nProvider>
);
};

View file

@ -20,6 +20,7 @@
],
"kbn_references": [
"@kbn/i18n",
"@kbn/kibana-utils-plugin"
"@kbn/kibana-utils-plugin",
"@kbn/i18n-react"
]
}