import { LocaleProvider } from './context';

import Basic from './demo/basic';
import WithText from './demo/with-text';
import DarkMode from './demo/dark-mode';
import PopperProps from './demo/popper-props';
import PopperTypeProps from './demo/popper-type-props';
import IconProps from './demo/icon-props';
import Languages from './demo/languages';

export default {
  title: 'Basic/LocaleSelector',

  parameters: {
    docs: {
      description: {
        component:
          'If you have multiple locales and want to give your users the option of selecting a language, you can use the LocaleSelector component.',
      },
      inlineStories: false,
      iframeHeight: 160,
    },
  },
  decorators: [
    (StoryFn) => (
      <LocaleProvider translations={{}}>
        <StoryFn />
      </LocaleProvider>
    ),
  ],
};

// demo 中使用了 react element, 设置 `inlineStories: false` 时导致 storybook 崩溃
IconProps.parameters = {
  docs: {
    inlineStories: true,
  },
};

Languages.argTypes = {
  fallbackLocale: { control: 'select', options: [null, 'en'] },
};

export { Basic, WithText, DarkMode, PopperProps, PopperTypeProps, IconProps, Languages };
