buttons.less 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. //
  2. // Buttons
  3. // --------------------------------------------------
  4. // Base styles
  5. // --------------------------------------------------
  6. .btn {
  7. display: inline-block;
  8. margin-bottom: 0; // For input.btn
  9. font-weight: @btn-font-weight;
  10. text-align: center;
  11. vertical-align: middle;
  12. cursor: pointer;
  13. border: 0 solid transparent;
  14. white-space: nowrap;
  15. .button-size(
  16. @padding-base-vertical; @padding-base-horizontal; @font-size-base;
  17. @line-height-base; @btn-border-radius-base
  18. );
  19. .user-select(none);
  20. &,
  21. &:active,
  22. &.active {
  23. &:focus {
  24. .tab-focus();
  25. }
  26. }
  27. &:hover,
  28. &:focus {
  29. color: @btn-default-color;
  30. text-decoration: none;
  31. }
  32. // &:active,
  33. // &.active {
  34. // }
  35. &.disabled,
  36. &[disabled],
  37. fieldset[disabled] & {
  38. &,
  39. &:hover,
  40. &:focus,
  41. &:active,
  42. &.active {
  43. cursor: not-allowed;
  44. opacity: 1; //needed to override deprecated styling in individual classes
  45. .box-shadow(none);
  46. }
  47. }
  48. &.disabled.btn-info,
  49. &.disabled.btn-default,
  50. &[disabled].btn-info,
  51. &[disabled].btn-default,
  52. fieldset[disabled].btn-info,
  53. fieldset[disabled].btn-default & {
  54. // style only for deprecated classes
  55. .opacity(0.65);
  56. }
  57. }
  58. // Alternate buttons
  59. // --------------------------------------------------
  60. .btn-default {
  61. .button-variant(@btn-default-color; @btn-default-bg; @btn-default-border);
  62. }
  63. .btn-default-outline {
  64. .button-outline-variant(@btn-default-bg);
  65. }
  66. .btn-primary {
  67. .btn-borderless();
  68. }
  69. .btn-primary-on-primary-bg {
  70. .button-variant(@white; @ol-dark-green; @ol-dark-green);
  71. }
  72. // Success appears as green
  73. .btn-success {
  74. .btn-primary;
  75. }
  76. // Info appears as blue-green
  77. .btn-info {
  78. .button-variant(@btn-info-color; @btn-info-bg; @btn-info-border);
  79. }
  80. // Warning appears as orange
  81. .btn-warning {
  82. .button-variant(@btn-warning-color; @btn-warning-bg; @btn-warning-border);
  83. }
  84. // Danger and error appear as red
  85. .btn-danger {
  86. .btn-borderless(@white, @red, @red-60);
  87. }
  88. // Danger Ghost and error appear as light red with no border
  89. .btn-danger-ghost {
  90. .btn-borderless(@red-50, @btn-danger-ghost-bg, @red-10);
  91. }
  92. // Info Ghost appear as info blue with no border
  93. .btn-info-ghost {
  94. .btn-borderless(@blue-50, @btn-info-ghost-bg, @blue-10);
  95. }
  96. // Background Ghost appear as neutral-90 (matching our text colour) with no border
  97. .btn-bg-ghost {
  98. .btn-borderless(@neutral-90, @btn-info-ghost-bg, @neutral-10);
  99. }
  100. // Inline button to fit text, without link styling.
  101. // TODO: generic class for other styles
  102. .btn-info-ghost-inline {
  103. .btn-borderless(@blue-50, @btn-info-ghost-bg, @blue-10);
  104. padding: 0 !important;
  105. font-size: inherit !important;
  106. vertical-align: inherit;
  107. }
  108. // btn-secondary
  109. .btn-secondary {
  110. .btn-bordered();
  111. }
  112. .btn-secondary-info {
  113. .btn-secondary;
  114. }
  115. // Buttons relating to premium features have a special background
  116. .btn-premium {
  117. .premium-background;
  118. color: @white;
  119. &:hover {
  120. background: @blue-70;
  121. }
  122. }
  123. .reset-btns {
  124. // reset all buttons back to their original colors
  125. .btn-danger {
  126. .btn-danger;
  127. }
  128. .btn-default {
  129. .btn-default;
  130. }
  131. .btn-default-outline {
  132. .btn-default-outline;
  133. }
  134. .btn-info {
  135. .btn-info;
  136. }
  137. .btn-primary {
  138. .btn-primary;
  139. }
  140. .btn-success {
  141. .btn-success;
  142. }
  143. .btn-warning {
  144. .btn-warning;
  145. }
  146. .btn-secondary {
  147. .btn-secondary;
  148. }
  149. }
  150. // Link buttons
  151. // -------------------------
  152. // Make a button look and behave like a link
  153. .btn-link {
  154. color: @link-color;
  155. font-weight: normal;
  156. cursor: pointer;
  157. border-radius: 0;
  158. &,
  159. &:active,
  160. &[disabled],
  161. fieldset[disabled] & {
  162. background-color: transparent;
  163. .box-shadow(none);
  164. }
  165. &,
  166. &:hover,
  167. &:focus,
  168. &:active {
  169. border-color: transparent;
  170. }
  171. &:hover,
  172. &:focus {
  173. color: @link-hover-color;
  174. text-decoration: underline;
  175. background-color: transparent;
  176. }
  177. &[disabled],
  178. fieldset[disabled] & {
  179. &:hover,
  180. &:focus {
  181. color: @btn-link-disabled-color;
  182. text-decoration: none;
  183. }
  184. }
  185. &.btn-danger {
  186. color: @ol-red;
  187. &:hover,
  188. &:focus {
  189. color: @ol-dark-red;
  190. }
  191. }
  192. }
  193. .btn-inline-link {
  194. .btn-link();
  195. padding: 0;
  196. font-size: inherit;
  197. vertical-align: inherit;
  198. }
  199. // Button Sizes
  200. // --------------------------------------------------
  201. .btn-xl {
  202. .button-size(
  203. @padding-large-vertical; @padding-large-horizontal; @font-size-h2;
  204. @line-height-large; @btn-border-radius-large
  205. );
  206. }
  207. .btn-lg {
  208. // line-height: ensure even-numbered height of button next to large input
  209. .button-size(
  210. @padding-large-vertical; @padding-large-horizontal; @font-size-large;
  211. @line-height-large; @btn-border-radius-large
  212. );
  213. }
  214. .btn-sm {
  215. // line-height: ensure proper height of button next to small input
  216. .button-size(
  217. @padding-small-vertical; @padding-small-horizontal; @font-size-small;
  218. @line-height-small; @btn-border-radius-small
  219. );
  220. }
  221. .btn-xs {
  222. .button-size(
  223. @padding-xs-vertical; @padding-xs-horizontal; @font-size-small;
  224. @line-height-small; @btn-border-radius-small
  225. );
  226. }
  227. // Block button
  228. // --------------------------------------------------
  229. .btn-block {
  230. display: block;
  231. width: 100%;
  232. padding-left: 0;
  233. padding-right: 0;
  234. }
  235. // Vertically space out multiple block buttons
  236. .btn-block + .btn-block {
  237. margin-top: 5px;
  238. }
  239. // Specificity overrides
  240. input[type='submit'],
  241. input[type='reset'],
  242. input[type='button'] {
  243. &.btn-block {
  244. width: 100%;
  245. }
  246. }
  247. .login-btn {
  248. .btn;
  249. .btn-secondary;
  250. position: relative;
  251. padding-left: 20px;
  252. padding-right: 0;
  253. }