_button.scss 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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: 1px solid transparent;
  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. &.button-secondary {
  109. border: 1px solid rgba(0, 0, 0, 0.2);
  110. }
  111. }
  112. &.button-small.bicolor {
  113. padding-left: 3.5em;
  114. &:before {
  115. width: 2em;
  116. font-size: 0.9rem;
  117. line-height: 1.65em;
  118. }
  119. }
  120. // + input[type=submit],
  121. // + input[type=reset],
  122. // + input[type=button],
  123. + .button {
  124. // + button {
  125. margin-left: 1em;
  126. }
  127. // A completely unstyled button
  128. &.unbutton {
  129. border-radius: 0;
  130. width: auto;
  131. height: auto;
  132. padding: 0;
  133. font-size: inherit;
  134. font-weight: normal;
  135. vertical-align: middle;
  136. display: inline;
  137. background-color: transparent;
  138. border: 0;
  139. color: inherit;
  140. text-decoration: none;
  141. text-transform: uppercase;
  142. white-space: nowrap;
  143. position: relative;
  144. overflow: hidden;
  145. box-sizing: border-box;
  146. -webkit-font-smoothing: auto;
  147. // stylelint-disable-next-line property-no-vendor-prefix
  148. -moz-appearance: none;
  149. }
  150. &:hover {
  151. background-color: $color-button-hover;
  152. color: $color-white;
  153. border-color: transparent;
  154. &.hover-no {
  155. background-color: $color-button-no;
  156. }
  157. }
  158. &.button-longrunning {
  159. span {
  160. @include transition(all 0.3s ease);
  161. transform: scale(0.9);
  162. display: inline-block;
  163. height: 0.9em;
  164. position: relative;
  165. opacity: 0;
  166. width: 0;
  167. visibility: hidden;
  168. text-align: center;
  169. padding-right: 0;
  170. }
  171. em {
  172. font-style: normal;
  173. }
  174. &.button-longrunning-active span {
  175. transform: scale(1);
  176. visibility: visible;
  177. width: 1em;
  178. opacity: 0.8;
  179. padding-right: 0.5em;
  180. }
  181. .icon-spinner:after {
  182. text-align: center;
  183. position: absolute;
  184. left: 0;
  185. margin: 0;
  186. line-height: 1em;
  187. display: inline-block;
  188. font-size: 1em;
  189. }
  190. }
  191. &:disabled,
  192. &[disabled],
  193. &.disabled {
  194. background-color: $color-grey-3;
  195. border-color: $color-grey-3;
  196. color: $color-grey-2;
  197. cursor: default;
  198. }
  199. &.button-secondary:disabled,
  200. &.button-secondary[disabled],
  201. &.button-secondary.disabled {
  202. background-color: $color-white;
  203. border-color: $color-grey-3;
  204. color: $color-grey-3;
  205. }
  206. &.button-nostroke {
  207. border: 0;
  208. }
  209. @include media-breakpoint-up(sm) {
  210. font-size: 0.95em;
  211. padding: 0 1.4em;
  212. height: 3em;
  213. &.icon.text-replace {
  214. width: 2.2rem;
  215. height: 2.2rem;
  216. &:before {
  217. line-height: 2.1em;
  218. }
  219. }
  220. &.button-small {
  221. &.icon.text-replace {
  222. height: 1.8rem;
  223. width: 1.8rem;
  224. // stylelint-disable-next-line max-nesting-depth
  225. &:before {
  226. line-height: 1.7em;
  227. }
  228. }
  229. }
  230. &.bicolor {
  231. padding-left: 3.7em;
  232. &:before {
  233. width: 2em;
  234. line-height: 2.2em;
  235. font-size: 1.1rem;
  236. }
  237. }
  238. &.button-small.bicolor {
  239. // line-height: 2.2em;
  240. padding-left: 3em;
  241. &:before {
  242. width: 1.8em;
  243. line-height: 1.65em;
  244. }
  245. }
  246. }
  247. }
  248. .button-small {
  249. padding: 0 0.8em;
  250. height: 2em;
  251. font-size: 0.95em;
  252. }
  253. .button-secondary {
  254. color: $color-button;
  255. background-color: transparent;
  256. }
  257. // Buttons which are only an icon
  258. .button.icon.text-replace {
  259. font-size: 0; // unavoidable duplication of setting in icons.scss
  260. width: 1.8rem;
  261. height: 1.8rem;
  262. &:before {
  263. line-height: 1.7em;
  264. }
  265. }
  266. .button-neutral {
  267. color: $color-grey-2;
  268. &:hover {
  269. color: $color-teal;
  270. }
  271. }
  272. .yes {
  273. background-color: $color-button-yes;
  274. border: 1px solid $color-button-yes;
  275. &.button-secondary {
  276. border: 1px solid $color-button-yes;
  277. color: $color-button-yes;
  278. background-color: transparent;
  279. }
  280. &:hover {
  281. color: $color-white;
  282. border-color: transparent;
  283. background-color: $color-button-yes-hover;
  284. }
  285. &.button-nobg:hover {
  286. color: $color-button-yes;
  287. background-color: transparent;
  288. }
  289. }
  290. .no,
  291. .serious {
  292. background-color: $color-button-no;
  293. border: 1px solid $color-button-no;
  294. &.button-secondary {
  295. border: 1px solid $color-button-no;
  296. color: $color-button-no;
  297. background-color: transparent;
  298. }
  299. &:hover {
  300. color: $color-white;
  301. border-color: transparent;
  302. background-color: $color-button-no-hover;
  303. }
  304. &.button-nobg:hover {
  305. color: $color-button-no;
  306. background-color: transparent;
  307. }
  308. }
  309. .button-nobg {
  310. border: 0;
  311. background-color: transparent;
  312. }
  313. .bicolor {
  314. border: 0;
  315. padding-left: 3.5em;
  316. &:before {
  317. font-size: 1rem;
  318. position: absolute;
  319. left: 0;
  320. top: 0;
  321. width: 2em;
  322. line-height: 1.85em;
  323. height: 100%;
  324. text-align: center;
  325. background-color: rgba(0, 0, 0, 0.2);
  326. display: block;
  327. }
  328. }
  329. .button-small.bicolor {
  330. padding-left: 3.5em;
  331. &:before {
  332. width: 2em;
  333. font-size: 0.8rem;
  334. line-height: 1.65em;
  335. }
  336. }
  337. a.button {
  338. line-height: 2.4em;
  339. height: auto;
  340. &.button-small {
  341. line-height: 1.85em;
  342. }
  343. @include media-breakpoint-up(sm) {
  344. line-height: 2.9em;
  345. }
  346. }
  347. // Special styles to counteract Firefox's completely unwarranted assumptions about button styles
  348. input[type=submit],
  349. input[type=reset],
  350. input[type=button],
  351. button {
  352. padding: 0 1em;
  353. @include media-breakpoint-up(sm) {
  354. &.button-small {
  355. height: 2em;
  356. }
  357. }
  358. }
  359. .button-group {
  360. @include clearfix;
  361. input[type=submit],
  362. input[type=reset],
  363. input[type=button],
  364. .button,
  365. button {
  366. border-radius: 0;
  367. float: left;
  368. margin-right: 1px;
  369. margin-left: 0;
  370. &:only-child {
  371. border-radius: 3px;
  372. }
  373. &:first-child {
  374. border-radius: 3px 0 0 3px;
  375. }
  376. &:last-child {
  377. border-radius: 0 3px 3px 0;
  378. margin-right: 0;
  379. }
  380. }
  381. &.button-group-square {
  382. &,
  383. input[type=submit],
  384. input[type=reset],
  385. input[type=button],
  386. .button,
  387. button {
  388. border-radius: 0;
  389. }
  390. }
  391. }
  392. .multiple {
  393. padding: 0;
  394. max-width: 1024px - 50px;
  395. overflow: hidden;
  396. > li {
  397. @include row();
  398. border-radius: 2px;
  399. position: relative;
  400. overflow: hidden;
  401. background-color: $color-white;
  402. padding: 1em 10em 1em 1.5em; // 10em padding leaves room for controls
  403. margin-bottom: 1em;
  404. 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
  405. }
  406. &.moving {
  407. position: relative;
  408. }
  409. li.moving {
  410. position: absolute;
  411. width: 100%;
  412. }
  413. fieldset {
  414. padding-top: 0;
  415. padding-bottom: 0;
  416. }
  417. // Object controls
  418. .controls {
  419. position: absolute;
  420. z-index: 1;
  421. right: 1em;
  422. top: 1em;
  423. color: $color-white;
  424. li {
  425. float: left;
  426. margin-right: 1px;
  427. &:last-child {
  428. margin-right: 0;
  429. }
  430. }
  431. .disabled {
  432. display: none;
  433. visibility: hidden;
  434. }
  435. }
  436. }
  437. // wrapper around add button for mutliple objects
  438. .add {
  439. font-weight: 700;
  440. cursor: pointer;
  441. margin-top: 0;
  442. margin-bottom: 0;
  443. padding-top: 1em;
  444. padding-bottom: 2em;
  445. clear: both;
  446. }