avatar.stories.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. import Avatar from 'sentry/components/avatar';
  2. const USER = {
  3. id: 1,
  4. name: 'Jane Bloggs',
  5. email: 'janebloggs@example.com',
  6. };
  7. export default {
  8. title: 'Components/Avatars',
  9. component: Avatar,
  10. args: {
  11. hasTooltip: false,
  12. suggested: false,
  13. },
  14. };
  15. export const Letters = ({...args}) => {
  16. const user = Object.assign({}, USER);
  17. return <Avatar user={user} {...args} />;
  18. };
  19. Letters.parameters = {
  20. docs: {
  21. description: {
  22. story: 'This is the default avatar',
  23. },
  24. },
  25. };
  26. export const Gravatar = ({...args}) => {
  27. const user = {
  28. id: 2,
  29. name: 'Ben Vinegar',
  30. email: 'ben@benv.ca',
  31. avatar: {
  32. avatarType: 'gravatar',
  33. avatarUuid: '2d641b5d-8c74-44de-9cb6-fbd54701b35e',
  34. },
  35. };
  36. return <Avatar user={user} {...args} />;
  37. };
  38. Gravatar.parameters = {
  39. docs: {
  40. description: {
  41. story: 'Avatar source from gravatar',
  42. },
  43. },
  44. };
  45. export const UploadedImage = ({...args}) => {
  46. const user = Object.assign({}, USER, {
  47. avatar: {
  48. avatarType: 'upload',
  49. avatarUuid: '51e63edabf31412aa2a955e9cf2c1ca0',
  50. },
  51. });
  52. return <Avatar user={user} {...args} />;
  53. };
  54. UploadedImage.parameters = {
  55. docs: {
  56. description: {
  57. story: 'Uploaded image',
  58. },
  59. },
  60. };
  61. export const TeamAvatar = ({...args}) => {
  62. const team = {
  63. name: 'Captain Planet',
  64. slug: 'captain-planet',
  65. };
  66. return <Avatar team={team} {...args} />;
  67. };
  68. TeamAvatar.parameters = {
  69. docs: {
  70. description: {
  71. story: 'Avatar for teams',
  72. },
  73. },
  74. };