Skip to content

Commit

Permalink
[Package][Expandable flyout] - fix Storybook (#185036)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippeOberti authored Jun 12, 2024
1 parent e767ef4 commit 2ae94e8
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 47 deletions.
98 changes: 57 additions & 41 deletions packages/kbn-expandable-flyout/src/index.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}>
Expand All @@ -117,15 +121,19 @@ export const Right: Story<void> = () => {
};

export const Left: Story<void> = () => {
const state = {
right: {
id: 'right',
},
left: {
id: 'left',
const state: State = {
byId: {
memory: {
right: {
id: 'right',
},
left: {
id: 'left',
},
preview: undefined,
},
},
preview: [],
} as unknown as State;
};

return (
<TestProvider state={state}>
Expand All @@ -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}>
Expand All @@ -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}>
Expand Down
13 changes: 8 additions & 5 deletions packages/kbn-expandable-flyout/src/test/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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>
);
};
3 changes: 2 additions & 1 deletion packages/kbn-expandable-flyout/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
],
"kbn_references": [
"@kbn/i18n",
"@kbn/kibana-utils-plugin"
"@kbn/kibana-utils-plugin",
"@kbn/i18n-react"
]
}

0 comments on commit 2ae94e8

Please sign in to comment.