global.tsx 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. import {css, Global} from '@emotion/react';
  2. import {IS_ACCEPTANCE_TEST} from 'app/constants';
  3. import {Theme} from 'app/utils/theme';
  4. const styles = (theme: Theme, isDark: boolean) => css`
  5. body {
  6. .sentry-error-embed-wrapper {
  7. z-index: ${theme.zIndex.sentryErrorEmbed};
  8. }
  9. color: ${theme.textColor};
  10. background: ${theme.backgroundSecondary};
  11. }
  12. abbr {
  13. border-bottom: 1px dotted ${theme.gray300};
  14. }
  15. a {
  16. color: ${theme.linkColor};
  17. &:hover {
  18. color: ${theme.linkHoverColor};
  19. }
  20. }
  21. .group-detail:before {
  22. background: ${theme.border};
  23. }
  24. .form-actions {
  25. border-top-color: ${theme.border};
  26. }
  27. /**
  28. * See https://web.dev/prefers-reduced-motion/
  29. */
  30. @media (prefers-reduced-motion) {
  31. *,
  32. ::before,
  33. ::after {
  34. animation-delay: -1ms !important;
  35. animation-duration: 0ms !important;
  36. animation-iteration-count: 1 !important;
  37. background-attachment: initial !important;
  38. scroll-behavior: auto !important;
  39. transition-duration: 0s !important;
  40. transition-delay: 0s !important;
  41. }
  42. }
  43. ${IS_ACCEPTANCE_TEST
  44. ? css`
  45. input,
  46. select {
  47. caret-color: transparent;
  48. }
  49. `
  50. : ''}
  51. /* Override css in LESS files here as we want to manually control dark mode for now */
  52. ${isDark
  53. ? css`
  54. .box {
  55. background: ${theme.background};
  56. }
  57. .loading .loading-indicator {
  58. border-color: ${theme.background};
  59. border-left-color: ${theme.purple300};
  60. }
  61. .saved-search-tab {
  62. border-bottom-color: ${theme.active} !important;
  63. }
  64. .nav-tabs {
  65. & > li {
  66. &.active {
  67. a {
  68. color: ${theme.textColor} !important;
  69. border-bottom-color: ${theme.active} !important;
  70. }
  71. }
  72. a:hover {
  73. color: ${theme.textColor} !important;
  74. }
  75. }
  76. &.border-bottom {
  77. border-color: ${theme.border};
  78. }
  79. }
  80. ul.crumbs li .table.key-value pre {
  81. color: ${theme.subText};
  82. }
  83. .exception {
  84. border-color: ${theme.innerBorder};
  85. }
  86. .traceback {
  87. border-color: ${theme.border};
  88. ol.context > li {
  89. color: ${theme.subText};
  90. }
  91. &.in-app-traceback {
  92. .frame {
  93. &.leads-to-app {
  94. &.collapsed {
  95. .title {
  96. border-color: ${theme.border};
  97. background: ${theme.background};
  98. }
  99. }
  100. }
  101. }
  102. }
  103. .frame,
  104. .frame.system-frame {
  105. border-top-color: ${theme.border};
  106. &.is-expandable .title:hover {
  107. background-color: ${theme.background};
  108. }
  109. .btn-toggle {
  110. color: ${theme.textColor};
  111. background: transparent;
  112. }
  113. .title {
  114. background-color: ${theme.backgroundSecondary};
  115. }
  116. &.is-expandable .title {
  117. background-color: ${theme.backgroundSecondary};
  118. }
  119. .context {
  120. background: ${theme.background};
  121. }
  122. }
  123. }
  124. .exc-message {
  125. color: ${theme.subText};
  126. }
  127. .group-detail h3 em {
  128. color: ${theme.subText};
  129. }
  130. .event-details-container {
  131. background-color: ${theme.background};
  132. .secondary {
  133. border-left-color: ${theme.border};
  134. }
  135. }
  136. /* Group Details - User context */
  137. .user-widget .avatar {
  138. box-shadow: 0 0 0 5px ${theme.background};
  139. background: ${theme.background};
  140. }
  141. .nav-header a.help-link,
  142. .nav-header span.help-link a {
  143. color: ${theme.subText};
  144. }
  145. pre,
  146. code {
  147. background-color: ${theme.backgroundSecondary};
  148. color: ${theme.textColor};
  149. }
  150. .search .search-input {
  151. background: ${theme.background};
  152. color: ${theme.formText};
  153. }
  154. /* Global Selection header date picker */
  155. .rdrCalendarWrapper {
  156. background: ${theme.background};
  157. color: ${theme.textColor};
  158. }
  159. .rdrDayDisabled {
  160. background-color: ${theme.backgroundSecondary};
  161. color: ${theme.disabled};
  162. }
  163. .rdrMonthAndYearPickers select {
  164. color: ${theme.textColor};
  165. }
  166. .dropdown-menu {
  167. color: ${theme.textColor};
  168. background-color: ${theme.background};
  169. &:after,
  170. &:before {
  171. border-bottom-color: ${theme.background};
  172. }
  173. }
  174. `
  175. : ''}
  176. `;
  177. /**
  178. * Renders an emotion global styles injection component
  179. */
  180. const GlobalStyles = ({theme, isDark}: {theme: Theme; isDark: boolean}) => (
  181. <Global styles={styles(theme, isDark)} />
  182. );
  183. export default GlobalStyles;