suggestedAvatarStack.stories.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import styled from '@emotion/styled';
  2. import SuggestedAvatarStack from 'sentry/components/avatar/suggestedAvatarStack';
  3. import TeamStore from 'sentry/stores/teamStore';
  4. const exampleUserActor = {
  5. type: 'user',
  6. id: '1',
  7. name: 'Jane Bloggs',
  8. };
  9. const exampleTeam = {
  10. id: '2',
  11. name: 'Captain Planet',
  12. slug: 'captain-planet',
  13. isMember: true,
  14. hasAccess: true,
  15. isPending: false,
  16. memberCount: 1,
  17. avatar: 'letter_avatar',
  18. };
  19. const exampleTeamActor = {
  20. type: 'team',
  21. id: exampleTeam.id,
  22. name: exampleTeam.name,
  23. };
  24. const suggestionsWithUser = [exampleUserActor, exampleTeamActor, exampleTeamActor];
  25. const suggestionsWithTeam = [exampleTeamActor, exampleUserActor, exampleTeamActor];
  26. const options = {
  27. User: suggestionsWithUser,
  28. Team: suggestionsWithTeam,
  29. };
  30. export default {
  31. title: 'Components/Avatars/Suggested Avatar',
  32. component: SuggestedAvatarStack,
  33. };
  34. export const SuggestedAvatars = ({...args}) => {
  35. // Setup mock data
  36. TeamStore.loadInitialData([exampleTeam]);
  37. return (
  38. <SuggestedAvatarContainer>
  39. <SuggestedAvatarStack size={24} {...args} />
  40. </SuggestedAvatarContainer>
  41. );
  42. };
  43. SuggestedAvatars.storyName = 'Suggested Avatar';
  44. SuggestedAvatars.args = {
  45. owners: suggestionsWithTeam,
  46. };
  47. SuggestedAvatars.argTypes = {
  48. owners: {
  49. control: {
  50. type: 'select',
  51. options,
  52. },
  53. },
  54. };
  55. SuggestedAvatars.parameters = {
  56. docs: {
  57. description: {
  58. story: 'Suggested avatar stack',
  59. },
  60. },
  61. };
  62. const SuggestedAvatarContainer = styled('div')`
  63. display: flex;
  64. `;