global.tsx 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. import {css, Global} from '@emotion/react';
  2. import {IS_ACCEPTANCE_TEST} from 'sentry/constants';
  3. import {Theme} from 'sentry/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. ${theme.tooltipUnderline()};
  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. pre,
  28. code {
  29. color: ${theme.textColor};
  30. }
  31. pre {
  32. background-color: ${theme.backgroundSecondary};
  33. }
  34. code {
  35. background-color: transparent;
  36. }
  37. /**
  38. * See https://web.dev/prefers-reduced-motion/
  39. */
  40. @media (prefers-reduced-motion) {
  41. *,
  42. ::before,
  43. ::after {
  44. animation-delay: -1ms !important;
  45. animation-duration: 0ms !important;
  46. animation-iteration-count: 1 !important;
  47. background-attachment: initial !important;
  48. scroll-behavior: auto !important;
  49. transition-duration: 0s !important;
  50. transition-delay: 0s !important;
  51. }
  52. }
  53. ${IS_ACCEPTANCE_TEST
  54. ? css`
  55. input,
  56. select {
  57. caret-color: transparent;
  58. }
  59. `
  60. : ''}
  61. /* Override css in LESS files here as we want to manually control dark mode for now */
  62. ${isDark
  63. ? css`
  64. .box {
  65. background: ${theme.background};
  66. .box-content,
  67. .box-header {
  68. background: ${theme.background};
  69. h1,
  70. h2,
  71. h3,
  72. h4,
  73. h5,
  74. h6 {
  75. color: ${theme.headingColor};
  76. }
  77. a {
  78. color: ${theme.textColor};
  79. }
  80. }
  81. .box-header {
  82. border-bottom-color: ${theme.border};
  83. }
  84. }
  85. .loading .loading-indicator {
  86. border-color: ${theme.backgroundSecondary};
  87. border-left-color: ${theme.purple300};
  88. }
  89. .saved-search-tab {
  90. border-bottom-color: ${theme.active} !important;
  91. }
  92. .nav-tabs {
  93. & > li {
  94. &.active {
  95. a {
  96. color: ${theme.textColor} !important;
  97. border-bottom-color: ${theme.active} !important;
  98. }
  99. }
  100. a:hover {
  101. color: ${theme.textColor} !important;
  102. }
  103. }
  104. &.border-bottom {
  105. border-color: ${theme.border};
  106. }
  107. }
  108. ul.crumbs li .table.key-value pre {
  109. color: ${theme.subText};
  110. }
  111. .exception {
  112. border-color: ${theme.innerBorder};
  113. }
  114. .traceback {
  115. border-color: ${theme.border};
  116. ol.context > li {
  117. color: ${theme.subText};
  118. }
  119. &.in-app-traceback {
  120. .frame {
  121. &.leads-to-app {
  122. &.collapsed {
  123. .title {
  124. border-color: ${theme.border};
  125. background: ${theme.background};
  126. }
  127. }
  128. }
  129. }
  130. }
  131. .frame,
  132. .frame.system-frame {
  133. border-top-color: ${theme.border};
  134. &.is-expandable .title:hover {
  135. background-color: ${theme.background};
  136. }
  137. .btn-toggle {
  138. color: ${theme.textColor};
  139. background: transparent;
  140. }
  141. .title {
  142. background-color: ${theme.backgroundSecondary};
  143. }
  144. &.is-expandable .title {
  145. background-color: ${theme.backgroundSecondary};
  146. }
  147. .context {
  148. background: ${theme.background};
  149. }
  150. }
  151. }
  152. .exc-message {
  153. color: ${theme.subText};
  154. }
  155. .group-detail h3 em {
  156. color: ${theme.subText};
  157. }
  158. .event-details-container {
  159. background-color: ${theme.background};
  160. .secondary {
  161. border-left-color: ${theme.border};
  162. }
  163. }
  164. /* Group Details - User context */
  165. .user-widget .avatar {
  166. box-shadow: 0 0 0 5px ${theme.background};
  167. background: ${theme.background};
  168. }
  169. .nav-header a.help-link,
  170. .nav-header span.help-link a {
  171. color: ${theme.subText};
  172. }
  173. .search .search-input {
  174. background: ${theme.background};
  175. color: ${theme.formText};
  176. }
  177. /* Global Selection header date picker */
  178. .rdrCalendarWrapper {
  179. background: ${theme.background};
  180. color: ${theme.textColor};
  181. }
  182. .rdrDayDisabled {
  183. background-color: ${theme.backgroundSecondary};
  184. color: ${theme.disabled};
  185. }
  186. .rdrMonthAndYearPickers select {
  187. color: ${theme.textColor};
  188. }
  189. .dropdown-menu {
  190. color: ${theme.textColor};
  191. background-color: ${theme.background} !important;
  192. border: 1px solid ${theme.border};
  193. &:before {
  194. border-bottom-color: ${theme.border};
  195. }
  196. &:after {
  197. border-bottom-color: ${theme.background};
  198. }
  199. &.inverted:before {
  200. border-top-color: ${theme.border};
  201. }
  202. &.inverted:after {
  203. border-top-color: ${theme.background};
  204. }
  205. }
  206. .context-summary .context-item.darwin .context-item-icon,
  207. .context-summary .context-item.ios .context-item-icon,
  208. .context-summary .context-item.macos .context-item-icon,
  209. .context-summary .context-item.tvos .context-item-icon,
  210. .context-summary .context-item.mac-os-x .context-item-icon,
  211. .context-summary .context-item.mac .context-item-icon,
  212. .context-summary .context-item.apple .context-item-icon,
  213. .context-summary .context-item.watchos .context-item-icon {
  214. filter: invert(100%);
  215. opacity: 0.8;
  216. }
  217. `
  218. : ''}
  219. `;
  220. /**
  221. * Renders an emotion global styles injection component
  222. */
  223. const GlobalStyles = ({theme, isDark}: {isDark: boolean; theme: Theme}) => (
  224. <Global styles={styles(theme, isDark)} />
  225. );
  226. export default GlobalStyles;