index.ts 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. // Copyright 2017-2020 @polkadot/react-components authors & contributors
  2. // This software may be modified and distributed under the terms
  3. // of the Apache-2.0 license. See the LICENSE file for details.
  4. import { createGlobalStyle } from 'styled-components';
  5. import cssComponents from './components';
  6. import cssForm from './form';
  7. import cssMedia from './media';
  8. import cssRx from './rx';
  9. import cssSemantic from './semantic';
  10. import cssTheme from './theme';
  11. import cssJoystream from './joystream';
  12. interface Props {
  13. uiHighlight?: string;
  14. }
  15. const defaultHighlight = '#4038FF'; // #999
  16. const getHighlight = (props: Props): string =>
  17. (props.uiHighlight || defaultHighlight);
  18. export default createGlobalStyle<Props>`
  19. .ui--highlight--all {
  20. background: ${getHighlight} !important;
  21. border-color: ${getHighlight} !important;
  22. color: ${getHighlight} !important;
  23. }
  24. .ui--highlight--before:before {
  25. background: ${getHighlight} !important;
  26. }
  27. .ui--highlight--bg {
  28. background: ${getHighlight} !important;
  29. }
  30. .ui--highlight--border {
  31. border-color: ${getHighlight} !important;
  32. }
  33. .ui--highlight--color {
  34. color: ${getHighlight} !important;
  35. }
  36. .ui--highlight--fill {
  37. fill: ${getHighlight} !important;
  38. }
  39. .ui--highlight--gradient {
  40. background: ${(props: Props) => `linear-gradient(90deg, ${props.uiHighlight || defaultHighlight}, transparent)`};
  41. }
  42. .ui--highlight--icon {
  43. .ui--Icon {
  44. color: ${getHighlight} !important;
  45. }
  46. }
  47. .ui--highlight--stroke {
  48. stroke: ${getHighlight} !important;
  49. }
  50. .ui--Button {
  51. &:not(.isDisabled):not(.isIcon):not(.isBasic) {
  52. .ui--Icon {
  53. background: ${getHighlight};
  54. color: #f5f5f4;
  55. }
  56. }
  57. &.isBasic:not(.isDisabled):not(.isIcon):not(.isSelected) {
  58. &:not(.isReadOnly) {
  59. box-shadow: 0 0 1px ${getHighlight};
  60. }
  61. .ui--Icon {
  62. color: ${getHighlight};
  63. }
  64. }
  65. &.isSelected {
  66. box-shadow: 0 0 1px ${getHighlight};
  67. }
  68. &:hover:not(.isDisabled):not(.isReadOnly),
  69. &.isSelected {
  70. background: ${getHighlight};
  71. color: #f5f5f4;
  72. text-shadow: none;
  73. &:not(.isIcon) {
  74. .ui--Icon {
  75. color: inherit;
  76. }
  77. }
  78. }
  79. }
  80. .ui--Table td .ui--Button {
  81. &:not(.isDisabled):not(.isIcon) {
  82. .ui--Icon {
  83. background: transparent;
  84. color: ${getHighlight};
  85. }
  86. }
  87. }
  88. .theme--default {
  89. .ui--Tabs-Tab.tabLinkActive {
  90. border-bottom-color: ${getHighlight};
  91. }
  92. .ui.negative.button,
  93. .ui.buttons .negative.button {
  94. background: #666 !important;
  95. }
  96. .ui.primary.button,
  97. .ui.buttons .primary.button {
  98. background: ${getHighlight};
  99. &.active,
  100. &:active,
  101. &:focus,
  102. &:hover {
  103. background-color: ${getHighlight};
  104. }
  105. }
  106. .ui--Toggle.isChecked .ui--Toggle-Slider {
  107. background-color: ${getHighlight} !important;
  108. &:before {
  109. border-color: ${getHighlight} !important;
  110. }
  111. }
  112. }
  113. #root {
  114. color: #4e4e4e;
  115. font-family: sans-serif;
  116. height: 100%;
  117. }
  118. a {
  119. cursor: pointer;
  120. }
  121. article {
  122. background: white;
  123. border: 1px solid #f2f2f2;
  124. border-radius: 0.25rem;
  125. box-sizing: border-box;
  126. margin: 0.25rem;
  127. padding: 1.25rem;
  128. position: relative;
  129. text-align: left;
  130. > ul {
  131. margin: 0;
  132. padding: 0;
  133. }
  134. &.error,
  135. &.warning {
  136. font-size: 0.95rem;
  137. margin-left: 2.25rem;
  138. padding: 0.75rem 1rem;
  139. }
  140. &.nomargin {
  141. margin-left: 0;
  142. }
  143. &.error {
  144. background: #fff6f6;
  145. border-color: #e0b4b4;
  146. color: #9f3a38;
  147. }
  148. &.padded {
  149. padding: 0.75rem 1rem;
  150. > div {
  151. margin: 0.25rem;
  152. }
  153. }
  154. &.warning {
  155. background: #ffffe0;
  156. border-color: #eeeeae;
  157. }
  158. }
  159. body {
  160. height: 100%;
  161. margin: 0;
  162. }
  163. br {
  164. line-height: 1.5rem;
  165. }
  166. details {
  167. cursor: pointer;
  168. &[open] > summary {
  169. white-space: normal;
  170. br, br + * {
  171. display: block;
  172. }
  173. }
  174. > summary {
  175. text-overflow: ellipsis;
  176. overflow: hidden;
  177. white-space: nowrap;
  178. outline: none;
  179. br, br + * {
  180. display: none;
  181. }
  182. }
  183. }
  184. h1, h2, h3, h4, h5 {
  185. color: rgba(0, 0, 0, .6);
  186. font-family: sans-serif;
  187. font-weight: 100;
  188. }
  189. h1 {
  190. text-transform: lowercase;
  191. em {
  192. font-style: normal;
  193. text-transform: none;
  194. }
  195. }
  196. h1, h2, h3, h4, h5 {
  197. margin-bottom: 0.25rem;
  198. }
  199. header {
  200. margin-bottom: 1.5rem;
  201. text-align: center;
  202. > article {
  203. background: transparent;
  204. }
  205. }
  206. html {
  207. height: 100%;
  208. }
  209. label {
  210. box-sizing: border-box;
  211. color: rgba(78, 78, 78, .66);
  212. display: block;
  213. font-family: sans-serif;
  214. font-size: 1rem;
  215. font-weight: 100;
  216. }
  217. main {
  218. min-height: 100vh;
  219. > section {
  220. margin-bottom: 2em;
  221. }
  222. }
  223. /* Add our overrides */
  224. ${cssSemantic}
  225. ${cssTheme}
  226. ${cssForm}
  227. ${cssMedia}
  228. ${cssRx}
  229. ${cssComponents}
  230. ${cssJoystream}
  231. `;