global.tsx 5.6 KB

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