global.tsx 5.7 KB

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