// @flow
import React from 'react';
import { addons, types } from '@storybook/addons';
import { AddonPanel } from '@storybook/components';
import { ThemePanel } from './theme-panel';
import { ADDON_ID, PANEL_ID } from './constants';

addons.register(ADDON_ID, api => {
  const render = ({ active, key }: { active: boolean, key: string }) => (
    <AddonPanel active={active} key={key}>
      <ThemePanel api={api} />
    </AddonPanel>
  );

  const title = 'Patchwork Theme';

  addons.add(PANEL_ID, {
    type: types.PANEL,
    title,
    render,
  });
});
