identityIcon.tsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import styled from '@emotion/styled';
  2. import asana from 'sentry-logos/logo-asana.svg';
  3. import auth0 from 'sentry-logos/logo-auth0.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 github from 'sentry-logos/logo-github.svg';
  9. import githubEnterprise from 'sentry-logos/logo-github-enterprise.svg';
  10. import gitlab from 'sentry-logos/logo-gitlab.svg';
  11. import google from 'sentry-logos/logo-google.svg';
  12. import jiraserver from 'sentry-logos/logo-jira-server.svg';
  13. import jumpcloud from 'sentry-logos/logo-jumpcloud.svg';
  14. import msteams from 'sentry-logos/logo-msteams.svg';
  15. import okta from 'sentry-logos/logo-okta.svg';
  16. import onelogin from 'sentry-logos/logo-onelogin.svg';
  17. import rippling from 'sentry-logos/logo-rippling.svg';
  18. import saml2 from 'sentry-logos/logo-saml2.svg';
  19. import slack from 'sentry-logos/logo-slack.svg';
  20. import visualstudio from 'sentry-logos/logo-visualstudio.svg';
  21. // Map of plugin id -> logo filename
  22. export const DEFAULT_ICON = placeholder;
  23. export const ICON_PATHS: Record<string, string> = {
  24. _default: DEFAULT_ICON,
  25. 'active-directory': vsts,
  26. asana,
  27. auth0,
  28. bitbucket,
  29. bitbucket_server: bitbucketserver,
  30. github,
  31. github_enterprise: githubEnterprise,
  32. gitlab,
  33. google,
  34. jira_server: jiraserver,
  35. jumpcloud,
  36. msteams,
  37. okta,
  38. onelogin,
  39. rippling,
  40. saml2,
  41. slack,
  42. visualstudio,
  43. vsts,
  44. };
  45. type Props = {
  46. providerId?: string;
  47. size?: number;
  48. };
  49. const IdentityIcon = styled('div')<Props>`
  50. position: relative;
  51. height: ${p => p.size}px;
  52. width: ${p => p.size}px;
  53. border-radius: 2px;
  54. border: 0;
  55. display: inline-block;
  56. background-size: contain;
  57. background-position: center center;
  58. background-repeat: no-repeat;
  59. background-image: url(${p =>
  60. (p.providerId !== undefined && ICON_PATHS[p.providerId]) || DEFAULT_ICON});
  61. `;
  62. IdentityIcon.defaultProps = {
  63. providerId: '_default',
  64. size: 36,
  65. };
  66. export default IdentityIcon;