index.ts 4.8 KB

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