_button.scss 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. /**
  2. * Buttons
  3. * --------------------------------------------------
  4. */
  5. .button {
  6. // set the color defaults
  7. @include button-style($button-default-bg, $button-default-border, $button-default-active-bg, $button-default-active-border, $button-default-text);
  8. position: relative;
  9. display: inline-block;
  10. margin: 0;
  11. padding: 0 $button-padding;
  12. min-width: ($button-padding * 3) + $button-font-size;
  13. min-height: $button-height + 5px;
  14. border-width: $button-border-width;
  15. border-style: solid;
  16. border-radius: $button-border-radius;
  17. vertical-align: top;
  18. text-align: center;
  19. text-overflow: ellipsis;
  20. font-size: $button-font-size;
  21. line-height: $button-height - $button-border-width + 1px;
  22. cursor: pointer;
  23. &:after {
  24. // used to create a larger button "hit" area
  25. position: absolute;
  26. top: -6px;
  27. right: -6px;
  28. bottom: -6px;
  29. left: -6px;
  30. content: ' ';
  31. }
  32. .icon {
  33. vertical-align: top;
  34. pointer-events: none;
  35. }
  36. .icon:before,
  37. &.icon:before,
  38. &.icon-left:before,
  39. &.icon-right:before {
  40. display: inline-block;
  41. padding: 0 0 $button-border-width 0;
  42. vertical-align: inherit;
  43. font-size: $button-icon-size;
  44. line-height: $button-height - $button-border-width;
  45. pointer-events: none;
  46. }
  47. &.icon-left:before {
  48. float: left;
  49. padding-right: .2em;
  50. padding-left: 0;
  51. }
  52. &.icon-right:before {
  53. float: right;
  54. padding-right: 0;
  55. padding-left: .2em;
  56. }
  57. &.button-block, &.button-full {
  58. margin-top: $button-block-margin;
  59. margin-bottom: $button-block-margin;
  60. }
  61. &.button-light {
  62. @include button-style($button-light-bg, $button-default-border, $button-light-active-bg, $button-default-active-border, $button-light-text);
  63. @include button-clear($button-light-border);
  64. @include button-outline($button-light-border);
  65. }
  66. &.button-stable {
  67. @include button-style($button-stable-bg, $button-default-border, $button-stable-active-bg, $button-default-active-border, $button-stable-text);
  68. @include button-clear($button-stable-border);
  69. @include button-outline($button-stable-border);
  70. }
  71. &.button-positive {
  72. @include button-style($button-positive-bg, $button-default-border, $button-positive-active-bg, $button-default-active-border, $button-positive-text);
  73. @include button-clear($button-positive-bg);
  74. @include button-outline($button-positive-bg);
  75. }
  76. &.button-calm {
  77. @include button-style($button-calm-bg, $button-default-border, $button-calm-active-bg, $button-default-active-border, $button-calm-text);
  78. @include button-clear($button-calm-bg);
  79. @include button-outline($button-calm-bg);
  80. }
  81. &.button-assertive {
  82. @include button-style($button-assertive-bg, $button-default-border, $button-assertive-active-bg, $button-default-active-border, $button-assertive-text);
  83. @include button-clear($button-assertive-bg);
  84. @include button-outline($button-assertive-bg);
  85. }
  86. &.button-balanced {
  87. @include button-style($button-balanced-bg, $button-default-border, $button-balanced-active-bg, $button-default-active-border, $button-balanced-text);
  88. @include button-clear($button-balanced-bg);
  89. @include button-outline($button-balanced-bg);
  90. }
  91. &.button-energized {
  92. @include button-style($button-energized-bg, $button-default-border, $button-energized-active-bg, $button-default-active-border, $button-energized-text);
  93. @include button-clear($button-energized-bg);
  94. @include button-outline($button-energized-bg);
  95. }
  96. &.button-royal {
  97. @include button-style($button-royal-bg, $button-default-border, $button-royal-active-bg, $button-default-active-border, $button-royal-text);
  98. @include button-clear($button-royal-bg);
  99. @include button-outline($button-royal-bg);
  100. }
  101. &.button-dark {
  102. @include button-style($button-dark-bg, $button-default-border, $button-dark-active-bg, $button-default-active-border, $button-dark-text);
  103. @include button-clear($button-dark-bg);
  104. @include button-outline($button-dark-bg);
  105. }
  106. }
  107. .button-small {
  108. padding: 2px $button-small-padding 1px;
  109. min-width: $button-small-height;
  110. min-height: $button-small-height + 2;
  111. font-size: $button-small-font-size;
  112. line-height: $button-small-height - $button-border-width - 1;
  113. .icon:before,
  114. &.icon:before,
  115. &.icon-left:before,
  116. &.icon-right:before {
  117. font-size: $button-small-icon-size;
  118. line-height: $button-small-icon-size + 3;
  119. margin-top: 3px;
  120. }
  121. }
  122. .button-large {
  123. padding: 0 $button-large-padding;
  124. min-width: ($button-large-padding * 3) + $button-large-font-size;
  125. min-height: $button-large-height + 5;
  126. font-size: $button-large-font-size;
  127. line-height: $button-large-height - $button-border-width;
  128. .icon:before,
  129. &.icon:before,
  130. &.icon-left:before,
  131. &.icon-right:before {
  132. padding-bottom: ($button-border-width * 2);
  133. font-size: $button-large-icon-size;
  134. line-height: $button-large-height - ($button-border-width * 2) - 1;
  135. }
  136. }
  137. .button-icon {
  138. @include transition(opacity .1s);
  139. padding: 0 6px;
  140. min-width: initial;
  141. border-color: transparent;
  142. background: none;
  143. &.button.active,
  144. &.button.activated {
  145. border-color: transparent;
  146. background: none;
  147. box-shadow: none;
  148. opacity: 0.3;
  149. }
  150. .icon:before,
  151. &.icon:before {
  152. font-size: $button-large-icon-size;
  153. }
  154. }
  155. .button-clear {
  156. @include button-clear($button-default-border);
  157. @include transition(opacity .1s);
  158. padding: 0 $button-clear-padding;
  159. max-height: $button-height;
  160. border-color: transparent;
  161. background: none;
  162. box-shadow: none;
  163. &.active,
  164. &.activated {
  165. opacity: 0.3;
  166. }
  167. }
  168. .button-outline {
  169. @include button-outline($button-default-border);
  170. @include transition(opacity .1s);
  171. background: none;
  172. box-shadow: none;
  173. }
  174. .padding > .button.button-block:first-child {
  175. margin-top: 0;
  176. }
  177. .button-block {
  178. display: block;
  179. clear: both;
  180. &:after {
  181. clear: both;
  182. }
  183. }
  184. .button-full,
  185. .button-full > .button {
  186. display: block;
  187. margin-right: 0;
  188. margin-left: 0;
  189. border-right-width: 0;
  190. border-left-width: 0;
  191. border-radius: 0;
  192. }
  193. button.button-block,
  194. button.button-full,
  195. .button-full > button.button,
  196. input.button.button-block {
  197. width: 100%;
  198. }
  199. a.button {
  200. text-decoration: none;
  201. .icon:before,
  202. &.icon:before,
  203. &.icon-left:before,
  204. &.icon-right:before {
  205. margin-top: 2px;
  206. }
  207. }
  208. .button.disabled,
  209. .button[disabled] {
  210. opacity: .4;
  211. cursor: default !important;
  212. pointer-events: none;
  213. }