global.tsx 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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. }
  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. /* Global Selection header date picker */
  173. .rdrCalendarWrapper {
  174. background: ${theme.background};
  175. color: ${theme.textColor};
  176. }
  177. .rdrDayDisabled {
  178. background-color: ${theme.backgroundSecondary};
  179. color: ${theme.disabled};
  180. }
  181. .rdrMonthAndYearPickers select {
  182. color: ${theme.textColor};
  183. }
  184. .dropdown-menu {
  185. color: ${theme.textColor};
  186. background-color: ${theme.background} !important;
  187. border: 1px solid ${theme.border};
  188. &:before {
  189. border-bottom-color: ${theme.border};
  190. }
  191. &:after {
  192. border-bottom-color: ${theme.background};
  193. }
  194. &.inverted:before {
  195. border-top-color: ${theme.border};
  196. }
  197. &.inverted:after {
  198. border-top-color: ${theme.background};
  199. }
  200. }
  201. `
  202. : ''}
  203. `;
  204. /**
  205. * Renders an emotion global styles injection component
  206. */
  207. const GlobalStyles = ({theme, isDark}: {isDark: boolean; theme: Theme}) => (
  208. <Global styles={styles(theme, isDark)} />
  209. );
  210. export default GlobalStyles;