_button.scss 11 KB

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