_button.scss 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  1. // Core button style
  2. // Note that these styles include methods to render buttons the same x-browser, described here:
  3. // http: //cbjdigital.com/blog/2010/08/bulletproof_css_input_button_heights
  4. // input[type=submit],
  5. // input[type=reset],
  6. // input[type=button],
  7. .button {
  8. border-radius: 3px;
  9. font-family: Open Sans,Arial,sans-serif;
  10. width: auto;
  11. height: 2.4em;
  12. padding: 0 1em;
  13. font-size: 0.9em;
  14. font-weight: normal;
  15. vertical-align: middle;
  16. display: inline-block;
  17. background-color: $color-button;
  18. border: 1px solid $color-button;
  19. color: $color-white;
  20. text-decoration: none;
  21. text-transform: uppercase;
  22. white-space: nowrap;
  23. position: relative;
  24. overflow: hidden;
  25. box-sizing: border-box;
  26. -webkit-font-smoothing: auto;
  27. // stylelint-disable-next-line property-no-vendor-prefix
  28. -moz-appearance: none;
  29. &:hover {
  30. color: $color-teal;
  31. }
  32. &.yes {
  33. background-color: $color-button-yes;
  34. border: 1px solid $color-button-yes;
  35. &.button-secondary {
  36. border: 1px solid $color-button-yes;
  37. color: $color-button-yes;
  38. background-color: transparent;
  39. }
  40. &:hover {
  41. color: $color-white;
  42. border-color: transparent;
  43. background-color: $color-button-yes-hover;
  44. }
  45. &.button-nobg:hover {
  46. color: $color-button-yes;
  47. background-color: transparent;
  48. }
  49. }
  50. &.warning {
  51. background-color: $color-button-warning;
  52. border: 1px solid $color-button-warning;
  53. &.button-secondary {
  54. border: 1px solid $color-button-warning;
  55. color: $color-button-warning;
  56. background-color: transparent;
  57. }
  58. &:hover {
  59. color: $color-white;
  60. border-color: transparent;
  61. background-color: $color-button-warning-hover;
  62. }
  63. &.button-nobg:hover {
  64. color: $color-button-warning;
  65. background-color: transparent;
  66. }
  67. }
  68. &.no,
  69. &.serious {
  70. background-color: $color-button-no;
  71. border: 1px solid $color-button-no;
  72. &.button-secondary {
  73. border: 1px solid $color-button-no;
  74. color: $color-button-no;
  75. background-color: transparent;
  76. }
  77. &:hover {
  78. color: $color-white;
  79. border-color: transparent;
  80. background-color: $color-button-no-hover;
  81. }
  82. &.button-nobg:hover {
  83. color: $color-button-no;
  84. background-color: transparent;
  85. }
  86. }
  87. &.button-nobg {
  88. border: 0;
  89. background-color: transparent;
  90. }
  91. &.bicolor {
  92. border: 0;
  93. padding-left: 3.5em;
  94. &:before {
  95. font-size: 1rem;
  96. position: absolute;
  97. left: 0;
  98. top: 0;
  99. width: 2em;
  100. line-height: 1.85em;
  101. height: 100%;
  102. text-align: center;
  103. background-color: rgba(0, 0, 0, 0.2);
  104. display: block;
  105. border-top-left-radius: inherit;
  106. border-bottom-left-radius: inherit;
  107. }
  108. }
  109. &.button-small.bicolor {
  110. padding-left: 3.5em;
  111. &:before {
  112. width: 2em;
  113. font-size: 0.9rem;
  114. line-height: 1.65em;
  115. }
  116. }
  117. // + input[type=submit],
  118. // + input[type=reset],
  119. // + input[type=button],
  120. + .button {
  121. // + button {
  122. margin-left: 1em;
  123. }
  124. // A completely unstyled button
  125. &.unbutton {
  126. border-radius: 0;
  127. width: auto;
  128. height: auto;
  129. padding: 0;
  130. font-size: inherit;
  131. font-weight: normal;
  132. vertical-align: middle;
  133. display: inline;
  134. background-color: transparent;
  135. border: 0;
  136. color: inherit;
  137. text-decoration: none;
  138. text-transform: uppercase;
  139. white-space: nowrap;
  140. position: relative;
  141. overflow: hidden;
  142. box-sizing: border-box;
  143. -webkit-font-smoothing: auto;
  144. // stylelint-disable-next-line property-no-vendor-prefix
  145. -moz-appearance: none;
  146. }
  147. &:hover {
  148. background-color: $color-button-hover;
  149. color: $color-white;
  150. border-color: transparent;
  151. &.hover-no {
  152. background-color: $color-button-no;
  153. }
  154. }
  155. &.button-longrunning {
  156. span {
  157. @include transition(all 0.3s ease);
  158. transform: scale(0.9);
  159. display: inline-block;
  160. height: 0.9em;
  161. position: relative;
  162. opacity: 0;
  163. width: 0;
  164. visibility: hidden;
  165. text-align: center;
  166. padding-right: 0;
  167. }
  168. em {
  169. font-style: normal;
  170. }
  171. &.button-longrunning-active span {
  172. transform: scale(1);
  173. visibility: visible;
  174. width: 1em;
  175. opacity: 0.8;
  176. padding-right: 0.5em;
  177. }
  178. .icon-spinner:after {
  179. text-align: center;
  180. position: absolute;
  181. left: 0;
  182. margin: 0;
  183. line-height: 1em;
  184. display: inline-block;
  185. font-size: 1em;
  186. }
  187. }
  188. &:disabled,
  189. &[disabled],
  190. &.disabled {
  191. background-color: $color-grey-3;
  192. border-color: $color-grey-3;
  193. color: $color-grey-2;
  194. cursor: default;
  195. }
  196. &.button-secondary:disabled,
  197. &.button-secondary[disabled],
  198. &.button-secondary.disabled {
  199. background-color: $color-white;
  200. border-color: $color-grey-3;
  201. color: $color-grey-3;
  202. }
  203. &.button-nostroke {
  204. border: 0;
  205. }
  206. @include media-breakpoint-up(sm) {
  207. font-size: 0.95em;
  208. padding: 0 1.4em;
  209. height: 3em;
  210. &.icon.text-replace {
  211. width: 2.2rem;
  212. height: 2.2rem;
  213. &:before {
  214. line-height: 2.1em;
  215. }
  216. }
  217. &.button-small {
  218. &.icon.text-replace {
  219. height: 1.8rem;
  220. width: 1.8rem;
  221. // stylelint-disable-next-line max-nesting-depth
  222. &:before {
  223. line-height: 1.7em;
  224. }
  225. }
  226. }
  227. &.bicolor {
  228. padding-left: 3.7em;
  229. &:before {
  230. width: 2em;
  231. line-height: 2.2em;
  232. font-size: 1.1rem;
  233. }
  234. }
  235. &.button-small.bicolor {
  236. // line-height: 2.2em;
  237. padding-left: 3em;
  238. &:before {
  239. width: 1.8em;
  240. line-height: 1.65em;
  241. }
  242. }
  243. }
  244. }
  245. .button-small {
  246. padding: 0 0.8em;
  247. height: 2em;
  248. font-size: 0.95em;
  249. }
  250. .button-secondary {
  251. color: $color-button;
  252. background-color: transparent;
  253. }
  254. // Buttons which are only an icon
  255. .button.icon.text-replace {
  256. font-size: 0; // unavoidable duplication of setting in icons.scss
  257. width: 1.8rem;
  258. height: 1.8rem;
  259. &:before {
  260. line-height: 1.7em;
  261. }
  262. }
  263. .button-neutral {
  264. color: $color-grey-2;
  265. &:hover {
  266. color: $color-teal;
  267. }
  268. }
  269. .yes {
  270. background-color: $color-button-yes;
  271. border: 1px solid $color-button-yes;
  272. &.button-secondary {
  273. border: 1px solid $color-button-yes;
  274. color: $color-button-yes;
  275. background-color: transparent;
  276. }
  277. &:hover {
  278. color: $color-white;
  279. border-color: transparent;
  280. background-color: $color-button-yes-hover;
  281. }
  282. &.button-nobg:hover {
  283. color: $color-button-yes;
  284. background-color: transparent;
  285. }
  286. }
  287. .no,
  288. .serious {
  289. background-color: $color-button-no;
  290. border: 1px solid $color-button-no;
  291. &.button-secondary {
  292. border: 1px solid $color-button-no;
  293. color: $color-button-no;
  294. background-color: transparent;
  295. }
  296. &:hover {
  297. color: $color-white;
  298. border-color: transparent;
  299. background-color: $color-button-no-hover;
  300. }
  301. &.button-nobg:hover {
  302. color: $color-button-no;
  303. background-color: transparent;
  304. }
  305. }
  306. .button-nobg {
  307. border: 0;
  308. background-color: transparent;
  309. }
  310. .bicolor {
  311. border: 0;
  312. padding-left: 3.5em;
  313. &:before {
  314. font-size: 1rem;
  315. position: absolute;
  316. left: 0;
  317. top: 0;
  318. width: 2em;
  319. line-height: 1.85em;
  320. height: 100%;
  321. text-align: center;
  322. background-color: rgba(0, 0, 0, 0.2);
  323. display: block;
  324. }
  325. }
  326. .button-small.bicolor {
  327. padding-left: 3.5em;
  328. &:before {
  329. width: 2em;
  330. font-size: 0.8rem;
  331. line-height: 1.65em;
  332. }
  333. }
  334. a.button {
  335. line-height: 2.4em;
  336. height: auto;
  337. &.button-small {
  338. line-height: 1.85em;
  339. }
  340. @include media-breakpoint-up(sm) {
  341. line-height: 2.9em;
  342. }
  343. }
  344. // Special styles to counteract Firefox's completely unwarranted assumptions about button styles
  345. input[type=submit],
  346. input[type=reset],
  347. input[type=button],
  348. button {
  349. padding: 0 1em;
  350. @include media-breakpoint-up(sm) {
  351. &.button-small {
  352. height: 2em;
  353. }
  354. }
  355. }
  356. .button-group {
  357. @include clearfix;
  358. input[type=submit],
  359. input[type=reset],
  360. input[type=button],
  361. .button,
  362. button {
  363. border-radius: 0;
  364. float: left;
  365. margin-right: 1px;
  366. margin-left: 0;
  367. &:only-child {
  368. border-radius: 3px;
  369. }
  370. &:first-child {
  371. border-radius: 3px 0 0 3px;
  372. }
  373. &:last-child {
  374. border-radius: 0 3px 3px 0;
  375. margin-right: 0;
  376. }
  377. }
  378. &.button-group-square {
  379. &,
  380. input[type=submit],
  381. input[type=reset],
  382. input[type=button],
  383. .button,
  384. button {
  385. border-radius: 0;
  386. }
  387. }
  388. }
  389. .multiple {
  390. padding: 0;
  391. max-width: 1024px - 50px;
  392. overflow: hidden;
  393. > li {
  394. @include row();
  395. border-radius: 2px;
  396. position: relative;
  397. overflow: hidden;
  398. background-color: $color-white;
  399. padding: 1em 10em 1em 1.5em; // 10em padding leaves room for controls
  400. margin-bottom: 1em;
  401. border: 1px solid lighten($color-grey-4, 3%); // really trying to avoid creating more greys, but this one is better than grey 4 or 5
  402. }
  403. &.moving {
  404. position: relative;
  405. }
  406. li.moving {
  407. position: absolute;
  408. width: 100%;
  409. }
  410. fieldset {
  411. padding-top: 0;
  412. padding-bottom: 0;
  413. }
  414. // Object controls
  415. .controls {
  416. position: absolute;
  417. z-index: 1;
  418. right: 1em;
  419. top: 1em;
  420. color: $color-white;
  421. li {
  422. float: left;
  423. margin-right: 1px;
  424. &:last-child {
  425. margin-right: 0;
  426. }
  427. }
  428. .disabled {
  429. display: none;
  430. visibility: hidden;
  431. }
  432. }
  433. }
  434. // wrapper around add button for mutliple objects
  435. .add {
  436. font-weight: 700;
  437. cursor: pointer;
  438. margin-top: 0;
  439. margin-bottom: 0;
  440. padding-top: 1em;
  441. padding-bottom: 2em;
  442. clear: both;
  443. }