global.tsx 5.4 KB

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