buttons.less 5.6 KB

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