previewGlobalStyles.tsx 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. import {css, Global} from '@emotion/react';
  2. import space from 'sentry/styles/space';
  3. import {Theme} from 'sentry/utils/theme';
  4. const styles = (theme: Theme) => css`
  5. html,
  6. body {
  7. font-family: ${theme.text.family};
  8. font-feature-settings: 'liga';
  9. font-size: ${theme.fontSizeLarge};
  10. color: ${theme.textColor};
  11. }
  12. div,
  13. p,
  14. a,
  15. button {
  16. font-family: ${theme.text.family};
  17. font-size: 1rem;
  18. color: ${theme.textColor};
  19. }
  20. /** Content wraps */
  21. #docs-root {
  22. display: flex;
  23. justify-content: center;
  24. background: ${theme.background};
  25. }
  26. .sbdocs.sbdocs-wrapper {
  27. padding: calc(${space(4)} * 3) calc(${space(4)} * 2);
  28. justify-content: flex-start;
  29. background: ${theme.background};
  30. }
  31. .sbdocs.sbdocs-content {
  32. position: relative;
  33. max-width: 48em;
  34. }
  35. .sidebar-container {
  36. border-right: solid 1px ${theme.innerBorder};
  37. }
  38. /** Dividers */
  39. .sbdocs.sbdocs-hr {
  40. margin: calc(${space(4)} * 2) 0;
  41. border-top: solid 1px ${theme.border};
  42. }
  43. /** Images */
  44. .sbdocs.sbdocs-img {
  45. width: 100%;
  46. margin: ${space(2)} 0;
  47. }
  48. .sbdocs.sbdocs-img.with-border {
  49. border-radius: ${theme.borderRadius};
  50. border: solid 1px ${theme.border};
  51. }
  52. /** Body text */
  53. .sbdocs.sbdocs-p {
  54. font-family: ${theme.text.family};
  55. font-size: 1rem;
  56. color: ${theme.textColor};
  57. margin: ${space(2)} 0;
  58. }
  59. .sbdocs.small {
  60. font-size: 0.875rem;
  61. color: ${theme.subText};
  62. }
  63. /** Links */
  64. .sbdocs.sbdocs-a {
  65. font-family: ${theme.text.family};
  66. font-size: 1rem;
  67. color: ${theme.blue300};
  68. text-decoration: underline;
  69. text-decoration-color: ${theme.blue100};
  70. margin: 0;
  71. }
  72. .sbdocs.sbdocs-a:hover {
  73. text-decoration-color: ${theme.blue200};
  74. }
  75. .sbdocs.sbdocs-a.gray-link {
  76. color: ${theme.subText};
  77. text-decoration: none;
  78. }
  79. .sbdocs.sbdocs-a.gray-link:hover {
  80. text-decoration: underline;
  81. text-decoration-color: ${theme.gray200};
  82. }
  83. /** Code */
  84. .sbdocs.sbdocs-pre {
  85. overflow: visible;
  86. }
  87. .sbdocs.sbdocs-wrapper *:not(pre) > code {
  88. font-family: ${theme.text.familyMono};
  89. font-size: 1rem;
  90. padding: 0.125rem 0.25rem;
  91. color: ${theme.textColor};
  92. background: ${theme.bodyBackground};
  93. border: solid 1px ${theme.innerBorder};
  94. }
  95. /** Lists */
  96. .sbdocs.sbdocs-ul,
  97. .sbdocs.sbdocs-ol {
  98. margin: ${space(2)} 0;
  99. }
  100. .sbdocs.sbdocs-li,
  101. .sbdocs.sbdocs-li:first-of-type,
  102. .sbdocs.sbdocs-li:last-child {
  103. font-family: ${theme.text.family};
  104. font-size: 1rem;
  105. color: ${theme.textColor};
  106. margin: ${space(1)} 0;
  107. }
  108. ul > .sbdocs.sbdocs-li ul > .sbdocs.sbdocs-li {
  109. list-style-type: circle;
  110. }
  111. ol > .sbdocs.sbdocs-li ol > .sbdocs.sbdocs-li {
  112. list-style-type: lower-alpha;
  113. }
  114. /** Headings */
  115. .sbdocs.sbdocs-h1,
  116. .sbdocs.sbdocs-h2,
  117. .sbdocs.sbdocs-h3,
  118. .sbdocs.sbdocs-h4 {
  119. font-family: ${theme.text.family};
  120. font-weight: 600;
  121. color: ${theme.textColor};
  122. border-bottom: none;
  123. }
  124. .sbdocs.sbdocs-h1 {
  125. font-size: 2.25rem;
  126. letter-spacing: -0.05rem;
  127. margin-bottom: ${space(4)};
  128. }
  129. .sbdocs.sbdocs-h2,
  130. .sbdocs.sbdocs-h2:first-of-type {
  131. font-size: 1.625rem;
  132. letter-spacing: -0.03rem;
  133. margin-top: 0;
  134. margin-bottom: ${space(2)};
  135. }
  136. .sbdocs.sbdocs-h3,
  137. .sbdocs.sbdocs-h3:first-of-type {
  138. font-size: 1.25rem;
  139. letter-spacing: -0.01rem;
  140. margin-top: ${space(4)};
  141. margin-bottom: ${space(1)};
  142. }
  143. .sbdocs.sbdocs-h3:first-of-type {
  144. margin-top: ${space(2)};
  145. }
  146. .sbdocs.sbdocs-h4,
  147. .sbdocs.sbdocs-h4:first-of-type {
  148. font-size: 1rem;
  149. margin-top: ${space(3)};
  150. margin-bottom: ${space(1)};
  151. }
  152. .sbdocs.sbdocs-h4:first-of-type {
  153. margin-top: ${space(2)};
  154. }
  155. `;
  156. const PreviewGlobalStyles = ({theme}: {theme: Theme}) => (
  157. <Global styles={styles(theme)} />
  158. );
  159. export default PreviewGlobalStyles;