global.tsx 5.5 KB

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