pluginIcon.tsx 3.1 KB

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