ActionButtonMenu.stories.tsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import React from 'react';
  2. import { ComponentStory, ComponentMeta } from '@storybook/react';
  3. import { action } from '@storybook/addon-actions';
  4. import { ActionButtonMenu } from './ActionButtonMenu';
  5. export default {
  6. title: 'owncast/Components/Action Buttons/Action Menu',
  7. component: ActionButtonMenu,
  8. parameters: {},
  9. } as ComponentMeta<typeof ActionButtonMenu>;
  10. const itemSelected = a => {
  11. console.log('itemSelected', a);
  12. action(a.title);
  13. };
  14. const Template: ComponentStory<typeof ActionButtonMenu> = args => (
  15. <ActionButtonMenu {...args} externalActionSelected={a => itemSelected(a)} />
  16. );
  17. const actions = [
  18. {
  19. url: 'https://owncast.online/docs',
  20. title: 'Documentation',
  21. description: 'Owncast Documentation',
  22. icon: 'https://owncast.online/images/logo.svg',
  23. color: '#5232c8',
  24. openExternally: false,
  25. },
  26. {
  27. url: 'https://opencollective.com/embed/owncast/donate',
  28. title: 'Support Owncast',
  29. description: 'Contribute to Owncast',
  30. icon: 'https://opencollective.com/static/images/opencollective-icon.svg',
  31. color: '#2b4863',
  32. openExternally: false,
  33. },
  34. ];
  35. export const Example = Template.bind({});
  36. Example.args = {
  37. actions,
  38. };
  39. export const ShowFollowExample = Template.bind({});
  40. ShowFollowExample.args = {
  41. actions,
  42. showFollowItem: true,
  43. };
  44. export const ShowNotifyExample = Template.bind({});
  45. ShowNotifyExample.args = {
  46. actions,
  47. showNotifyItem: true,
  48. };
  49. export const ShowNotifyAndFollowExample = Template.bind({});
  50. ShowNotifyAndFollowExample.args = {
  51. actions,
  52. showNotifyItem: true,
  53. showFollowItem: true,
  54. };