global.tsx 6.2 KB

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