0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-23 22:27:34 -05:00
verdaccio/packages/ui-components/.storybook/preview.js
Juan Picado a1f78368c4
docs: add pages to ui components (#3557)
* rename method

* Update ui-components.md

* clean up jest

* docs: add pages to ui components

* Update ui-components.yml

* chore: add some example docs
2023-01-08 11:27:37 +01:00

52 lines
1.4 KiB
JavaScript

import Flags from 'country-flag-icons/react/3x2';
import { Provider } from 'react-redux';
import config from '../../plugins/ui-theme/src/i18n/config';
import {
AppConfigurationProvider,
StyleBaseline,
ThemeProvider,
TranslatorProvider,
store,
} from '../src/';
const DEFAULT_LANGUAGE = 'en-US';
const listLanguages = [
{ lng: DEFAULT_LANGUAGE, icon: Flags.US, menuKey: 'lng.english' },
{ lng: 'cs-CZ', icon: Flags.CZ, menuKey: 'lng.czech' },
{ lng: 'pt-BR', icon: Flags.BR, menuKey: 'lng.portuguese' },
{ lng: 'es-ES', icon: Flags.ES, menuKey: 'lng.spanish' },
{ lng: 'de-DE', icon: Flags.DE, menuKey: 'lng.german' },
];
export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
};
// preview-head file contains the __VERDACCIO_BASENAME_UI_OPTIONS
// required by AppConfigurationProvider
export const withMuiTheme = (Story) => (
<Provider store={store}>
<TranslatorProvider onMount={() => {}} i18n={config} listLanguages={listLanguages}>
<AppConfigurationProvider>
<ThemeProvider>
<StyleBaseline />
<Story />
</ThemeProvider>
</AppConfigurationProvider>
</TranslatorProvider>
</Provider>
);
if (typeof global.process === 'undefined') {
const { worker } = require('../msw/browser');
worker.start();
}
export const decorators = [withMuiTheme];