global.tsx 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. .pattern-bg {
  86. opacity: 1;
  87. filter: invert(1) brightness(0.6);
  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. &.in-app-traceback {
  114. .frame {
  115. &.leads-to-app {
  116. &.collapsed {
  117. .title {
  118. border-color: ${theme.border};
  119. background: ${theme.background};
  120. }
  121. }
  122. }
  123. }
  124. }
  125. .frame,
  126. .frame.system-frame {
  127. border-top-color: ${theme.border};
  128. &.is-expandable .title:hover {
  129. background-color: ${theme.background};
  130. }
  131. .btn-toggle {
  132. color: ${theme.textColor};
  133. background: transparent;
  134. }
  135. .title {
  136. background-color: ${theme.backgroundSecondary};
  137. }
  138. &.is-expandable .title {
  139. background-color: ${theme.backgroundSecondary};
  140. }
  141. .context {
  142. background: ${theme.background};
  143. table.key-value {
  144. border-color: ${theme.border};
  145. td {
  146. border-color: ${theme.border} !important;
  147. }
  148. }
  149. }
  150. }
  151. }
  152. .exc-message {
  153. color: ${theme.subText};
  154. }
  155. .group-detail h3 em {
  156. color: ${theme.subText};
  157. }
  158. .event-details-container {
  159. background-color: ${theme.background};
  160. .secondary {
  161. border-left-color: ${theme.border};
  162. }
  163. }
  164. /* Group Details - User context */
  165. .user-widget .avatar {
  166. box-shadow: 0 0 0 5px ${theme.background};
  167. background: ${theme.background};
  168. }
  169. .nav-header a.help-link,
  170. .nav-header span.help-link a {
  171. color: ${theme.subText};
  172. }
  173. /* Global Selection header date picker */
  174. .rdrCalendarWrapper {
  175. background: ${theme.background};
  176. color: ${theme.textColor};
  177. }
  178. .rdrDayDisabled {
  179. background-color: ${theme.backgroundSecondary};
  180. color: ${theme.disabled};
  181. }
  182. .rdrMonthAndYearPickers select {
  183. color: ${theme.textColor};
  184. }
  185. .dropdown-menu {
  186. color: ${theme.textColor};
  187. background-color: ${theme.background} !important;
  188. border: 1px solid ${theme.border};
  189. &:before {
  190. border-bottom-color: ${theme.border};
  191. }
  192. &:after {
  193. border-bottom-color: ${theme.background};
  194. }
  195. &.inverted:before {
  196. border-top-color: ${theme.border};
  197. }
  198. &.inverted:after {
  199. border-top-color: ${theme.background};
  200. }
  201. }
  202. `
  203. : ''}
  204. `;
  205. /**
  206. * Renders an emotion global styles injection component
  207. */
  208. function GlobalStyles({theme, isDark}: {isDark: boolean; theme: Theme}) {
  209. return <Global styles={styles(theme, isDark)} />;
  210. }
  211. export default GlobalStyles;