buttons.less 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  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. }
  120. .reset-btns {
  121. // reset all buttons back to their original colors
  122. .btn-danger {
  123. .btn-danger;
  124. }
  125. .btn-default {
  126. .btn-default;
  127. }
  128. .btn-default-outline {
  129. .btn-default-outline;
  130. }
  131. .btn-info {
  132. .btn-info;
  133. }
  134. .btn-primary {
  135. .btn-primary;
  136. }
  137. .btn-success {
  138. .btn-success;
  139. }
  140. .btn-warning {
  141. .btn-warning;
  142. }
  143. .btn-secondary {
  144. .btn-secondary;
  145. }
  146. }
  147. // Link buttons
  148. // -------------------------
  149. // Make a button look and behave like a link
  150. .btn-link {
  151. color: @link-color;
  152. font-weight: normal;
  153. cursor: pointer;
  154. border-radius: 0;
  155. &,
  156. &:active,
  157. &[disabled],
  158. fieldset[disabled] & {
  159. background-color: transparent;
  160. .box-shadow(none);
  161. }
  162. &,
  163. &:hover,
  164. &:focus,
  165. &:active {
  166. border-color: transparent;
  167. }
  168. &:hover,
  169. &:focus {
  170. color: @link-hover-color;
  171. text-decoration: underline;
  172. background-color: transparent;
  173. }
  174. &[disabled],
  175. fieldset[disabled] & {
  176. &:hover,
  177. &:focus {
  178. color: @btn-link-disabled-color;
  179. text-decoration: none;
  180. }
  181. }
  182. &.btn-danger {
  183. color: @ol-red;
  184. &:hover,
  185. &:focus {
  186. color: @ol-dark-red;
  187. }
  188. }
  189. }
  190. .btn-inline-link {
  191. .btn-link();
  192. padding: 0;
  193. font-size: inherit;
  194. vertical-align: inherit;
  195. }
  196. // Button Sizes
  197. // --------------------------------------------------
  198. .btn-xl {
  199. .button-size(
  200. @padding-large-vertical; @padding-large-horizontal; @font-size-h2;
  201. @line-height-large; @btn-border-radius-large
  202. );
  203. }
  204. .btn-lg {
  205. // line-height: ensure even-numbered height of button next to large input
  206. .button-size(
  207. @padding-large-vertical; @padding-large-horizontal; @font-size-large;
  208. @line-height-large; @btn-border-radius-large
  209. );
  210. }
  211. .btn-sm {
  212. // line-height: ensure proper height of button next to small input
  213. .button-size(
  214. @padding-small-vertical; @padding-small-horizontal; @font-size-small;
  215. @line-height-small; @btn-border-radius-small
  216. );
  217. }
  218. .btn-xs {
  219. .button-size(
  220. @padding-xs-vertical; @padding-xs-horizontal; @font-size-small;
  221. @line-height-small; @btn-border-radius-small
  222. );
  223. }
  224. // Block button
  225. // --------------------------------------------------
  226. .btn-block {
  227. display: block;
  228. width: 100%;
  229. padding-left: 0;
  230. padding-right: 0;
  231. }
  232. // Vertically space out multiple block buttons
  233. .btn-block + .btn-block {
  234. margin-top: 5px;
  235. }
  236. // Specificity overrides
  237. input[type='submit'],
  238. input[type='reset'],
  239. input[type='button'] {
  240. &.btn-block {
  241. width: 100%;
  242. }
  243. }
  244. .login-btn {
  245. .btn;
  246. .btn-secondary;
  247. position: relative;
  248. padding-left: 20px;
  249. padding-right: 0;
  250. }
  251. .login-expand-more-btn {
  252. display: list-item;
  253. }