pluginIcon.tsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. import styled from '@emotion/styled';
  2. import asana from 'sentry-logos/logo-asana.svg';
  3. import aws from 'sentry-logos/logo-aws.svg';
  4. import vsts from 'sentry-logos/logo-azure.svg';
  5. import bitbucket from 'sentry-logos/logo-bitbucket.svg';
  6. import bitbucketserver from 'sentry-logos/logo-bitbucket-server.svg';
  7. import placeholder from 'sentry-logos/logo-default.svg';
  8. import discord from 'sentry-logos/logo-discord.svg';
  9. import github from 'sentry-logos/logo-github.svg';
  10. import githubEnterprise from 'sentry-logos/logo-github-enterprise.svg';
  11. import gitlab from 'sentry-logos/logo-gitlab.svg';
  12. import heroku from 'sentry-logos/logo-heroku.svg';
  13. import jira from 'sentry-logos/logo-jira.svg';
  14. import jiraserver from 'sentry-logos/logo-jira-server.svg';
  15. import jumpcloud from 'sentry-logos/logo-jumpcloud.svg';
  16. import msteams from 'sentry-logos/logo-msteams.svg';
  17. import opsgenie from 'sentry-logos/logo-opsgenie.svg';
  18. import pagerduty from 'sentry-logos/logo-pagerduty.svg';
  19. import phabricator from 'sentry-logos/logo-phabricator.svg';
  20. import pivotal from 'sentry-logos/logo-pivotaltracker.svg';
  21. import pushover from 'sentry-logos/logo-pushover.svg';
  22. import redmine from 'sentry-logos/logo-redmine.svg';
  23. import segment from 'sentry-logos/logo-segment.svg';
  24. import sentry from 'sentry-logos/logo-sentry.svg';
  25. import slack from 'sentry-logos/logo-slack.svg';
  26. import trello from 'sentry-logos/logo-trello.svg';
  27. import twilio from 'sentry-logos/logo-twilio.svg';
  28. import vercel from 'sentry-logos/logo-vercel.svg';
  29. import victorops from 'sentry-logos/logo-victorops.svg';
  30. import visualstudio from 'sentry-logos/logo-visualstudio.svg';
  31. // Map of plugin id -> logo filename
  32. export const DEFAULT_ICON = placeholder;
  33. export const ICON_PATHS = {
  34. _default: DEFAULT_ICON,
  35. sentry,
  36. browsers: sentry,
  37. device: sentry,
  38. interface_types: sentry,
  39. os: sentry,
  40. urls: sentry,
  41. webhooks: sentry,
  42. 'amazon-sqs': aws,
  43. aws_lambda: aws,
  44. asana,
  45. bitbucket,
  46. bitbucket_pipelines: bitbucket,
  47. bitbucket_server: bitbucketserver,
  48. discord,
  49. github,
  50. github_enterprise: githubEnterprise,
  51. gitlab,
  52. heroku,
  53. jira,
  54. jira_server: jiraserver,
  55. jumpcloud,
  56. msteams,
  57. opsgenie,
  58. pagerduty,
  59. phabricator,
  60. pivotal,
  61. pushover,
  62. redmine,
  63. segment,
  64. slack,
  65. trello,
  66. twilio,
  67. visualstudio,
  68. vsts,
  69. vercel,
  70. victorops,
  71. };
  72. type Props = {
  73. pluginId?: string;
  74. size?: number;
  75. };
  76. const PluginIcon = styled('div')<Props>`
  77. position: relative;
  78. height: ${p => p.size}px;
  79. width: ${p => p.size}px;
  80. min-width: ${p => p.size}px;
  81. border-radius: 2px;
  82. border: 0;
  83. display: inline-block;
  84. background-size: contain;
  85. background-position: center center;
  86. background-repeat: no-repeat;
  87. background-image: url(${({pluginId}) =>
  88. (pluginId !== undefined && ICON_PATHS[pluginId]) || DEFAULT_ICON});
  89. `;
  90. PluginIcon.defaultProps = {
  91. pluginId: '_default',
  92. size: 20,
  93. };
  94. export default PluginIcon;