global.tsx 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. .box.box-modal {
  66. background: ${theme.background};
  67. border-color: ${theme.border};
  68. .box-content,
  69. .box-header {
  70. background: ${theme.background};
  71. h1,
  72. h2,
  73. h3,
  74. h4,
  75. h5,
  76. h6 {
  77. color: ${theme.headingColor};
  78. }
  79. a {
  80. color: ${theme.textColor};
  81. }
  82. }
  83. .box-header {
  84. border-bottom-color: ${theme.border};
  85. }
  86. }
  87. .loading .loading-indicator {
  88. border-color: ${theme.backgroundSecondary};
  89. border-left-color: ${theme.purple300};
  90. }
  91. .nav-tabs {
  92. & > li {
  93. &.active {
  94. a {
  95. color: ${theme.textColor} !important;
  96. border-bottom-color: ${theme.active} !important;
  97. }
  98. }
  99. a:hover {
  100. color: ${theme.textColor} !important;
  101. }
  102. }
  103. &.border-bottom {
  104. border-color: ${theme.border};
  105. }
  106. }
  107. ul.crumbs li .table.key-value pre {
  108. color: ${theme.subText};
  109. }
  110. .exception {
  111. border-color: ${theme.innerBorder};
  112. }
  113. .traceback {
  114. border-color: ${theme.border};
  115. ol.context > li {
  116. color: ${theme.subText};
  117. }
  118. &.in-app-traceback {
  119. .frame {
  120. &.leads-to-app {
  121. &.collapsed {
  122. .title {
  123. border-color: ${theme.border};
  124. background: ${theme.background};
  125. }
  126. }
  127. }
  128. }
  129. }
  130. .frame,
  131. .frame.system-frame {
  132. border-top-color: ${theme.border};
  133. &.is-expandable .title:hover {
  134. background-color: ${theme.background};
  135. }
  136. .btn-toggle {
  137. color: ${theme.textColor};
  138. background: transparent;
  139. }
  140. .title {
  141. background-color: ${theme.backgroundSecondary};
  142. }
  143. &.is-expandable .title {
  144. background-color: ${theme.backgroundSecondary};
  145. }
  146. .context {
  147. background: ${theme.background};
  148. }
  149. }
  150. }
  151. .exc-message {
  152. color: ${theme.subText};
  153. }
  154. .group-detail h3 em {
  155. color: ${theme.subText};
  156. }
  157. .event-details-container {
  158. background-color: ${theme.background};
  159. .secondary {
  160. border-left-color: ${theme.border};
  161. }
  162. }
  163. /* Group Details - User context */
  164. .user-widget .avatar {
  165. box-shadow: 0 0 0 5px ${theme.background};
  166. background: ${theme.background};
  167. }
  168. .nav-header a.help-link,
  169. .nav-header span.help-link a {
  170. color: ${theme.subText};
  171. }
  172. .search .search-input {
  173. background: ${theme.background};
  174. color: ${theme.formText};
  175. }
  176. /* Global Selection header date picker */
  177. .rdrCalendarWrapper {
  178. background: ${theme.background};
  179. color: ${theme.textColor};
  180. }
  181. .rdrDayDisabled {
  182. background-color: ${theme.backgroundSecondary};
  183. color: ${theme.disabled};
  184. }
  185. .rdrMonthAndYearPickers select {
  186. color: ${theme.textColor};
  187. }
  188. .dropdown-menu {
  189. color: ${theme.textColor};
  190. background-color: ${theme.background} !important;
  191. border: 1px solid ${theme.border};
  192. &:before {
  193. border-bottom-color: ${theme.border};
  194. }
  195. &:after {
  196. border-bottom-color: ${theme.background};
  197. }
  198. &.inverted:before {
  199. border-top-color: ${theme.border};
  200. }
  201. &.inverted:after {
  202. border-top-color: ${theme.background};
  203. }
  204. }
  205. .context-summary .context-item.darwin .context-item-icon,
  206. .context-summary .context-item.ios .context-item-icon,
  207. .context-summary .context-item.macos .context-item-icon,
  208. .context-summary .context-item.tvos .context-item-icon,
  209. .context-summary .context-item.mac-os-x .context-item-icon,
  210. .context-summary .context-item.mac .context-item-icon,
  211. .context-summary .context-item.apple .context-item-icon,
  212. .context-summary .context-item.watchos .context-item-icon {
  213. filter: invert(100%);
  214. opacity: 0.8;
  215. }
  216. `
  217. : ''}
  218. `;
  219. /**
  220. * Renders an emotion global styles injection component
  221. */
  222. const GlobalStyles = ({theme, isDark}: {isDark: boolean; theme: Theme}) => (
  223. <Global styles={styles(theme, isDark)} />
  224. );
  225. export default GlobalStyles;