buttons.less 5.6 KB

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