global.tsx 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. import {css, Global, Theme} from '@emotion/react';
  2. import {IS_ACCEPTANCE_TEST} from 'sentry/constants';
  3. import {prismStyles} from 'sentry/styles/prism';
  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. white-space: pre-wrap;
  34. overflow-x: auto;
  35. }
  36. code {
  37. background-color: transparent;
  38. }
  39. ${prismStyles(theme)}
  40. /**
  41. * See https://web.dev/prefers-reduced-motion/
  42. */
  43. @media (prefers-reduced-motion) {
  44. *,
  45. ::before,
  46. ::after {
  47. animation-delay: -1ms !important;
  48. animation-duration: 0ms !important;
  49. animation-iteration-count: 1 !important;
  50. background-attachment: initial !important;
  51. scroll-behavior: auto !important;
  52. transition-duration: 0s !important;
  53. transition-delay: 0s !important;
  54. }
  55. }
  56. ${IS_ACCEPTANCE_TEST
  57. ? css`
  58. input,
  59. select {
  60. caret-color: transparent;
  61. }
  62. `
  63. : ''}
  64. /* Override css in LESS files here as we want to manually control dark mode for now */
  65. ${isDark
  66. ? css`
  67. .box,
  68. .box.box-modal {
  69. background: ${theme.background};
  70. border-color: ${theme.border};
  71. .box-content,
  72. .box-header {
  73. background: ${theme.background};
  74. h1,
  75. h2,
  76. h3,
  77. h4,
  78. h5,
  79. h6 {
  80. color: ${theme.headingColor};
  81. }
  82. a {
  83. color: ${theme.textColor};
  84. }
  85. }
  86. .box-header {
  87. border-bottom-color: ${theme.border};
  88. }
  89. }
  90. .loading .loading-indicator {
  91. border-color: ${theme.backgroundSecondary};
  92. border-left-color: ${theme.purple300};
  93. }
  94. .nav-tabs {
  95. & > li {
  96. &.active {
  97. a {
  98. color: ${theme.textColor} !important;
  99. border-bottom-color: ${theme.active} !important;
  100. }
  101. }
  102. a:hover {
  103. color: ${theme.textColor} !important;
  104. }
  105. }
  106. &.border-bottom {
  107. border-color: ${theme.border};
  108. }
  109. }
  110. ul.crumbs li .table.key-value pre {
  111. color: ${theme.subText};
  112. }
  113. .exception {
  114. border-color: ${theme.innerBorder};
  115. }
  116. .traceback {
  117. border-color: ${theme.border};
  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. table.key-value {
  149. border-color: ${theme.border};
  150. td {
  151. border-color: ${theme.border} !important;
  152. }
  153. }
  154. }
  155. }
  156. }
  157. .exc-message {
  158. color: ${theme.subText};
  159. }
  160. .group-detail h3 em {
  161. color: ${theme.subText};
  162. }
  163. .event-details-container {
  164. background-color: ${theme.background};
  165. .secondary {
  166. border-left-color: ${theme.border};
  167. }
  168. }
  169. /* Group Details - User context */
  170. .user-widget .avatar {
  171. box-shadow: 0 0 0 5px ${theme.background};
  172. background: ${theme.background};
  173. }
  174. .nav-header a.help-link,
  175. .nav-header span.help-link a {
  176. color: ${theme.subText};
  177. }
  178. /* Global Selection header date picker */
  179. .rdrCalendarWrapper {
  180. background: ${theme.background};
  181. color: ${theme.textColor};
  182. }
  183. .rdrDayDisabled {
  184. background-color: ${theme.backgroundSecondary};
  185. color: ${theme.disabled};
  186. }
  187. .rdrMonthAndYearPickers select {
  188. color: ${theme.textColor};
  189. }
  190. .dropdown-menu {
  191. color: ${theme.textColor};
  192. background-color: ${theme.background} !important;
  193. border: 1px solid ${theme.border};
  194. &:before {
  195. border-bottom-color: ${theme.border};
  196. }
  197. &:after {
  198. border-bottom-color: ${theme.background};
  199. }
  200. &.inverted:before {
  201. border-top-color: ${theme.border};
  202. }
  203. &.inverted:after {
  204. border-top-color: ${theme.background};
  205. }
  206. }
  207. `
  208. : ''}
  209. `;
  210. /**
  211. * Renders an emotion global styles injection component
  212. */
  213. const GlobalStyles = ({theme, isDark}: {isDark: boolean; theme: Theme}) => (
  214. <Global styles={styles(theme, isDark)} />
  215. );
  216. export default GlobalStyles;