Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

button.sass 8.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. $button-color: $grey-darker !default
  2. $button-background-color: $white !default
  3. $button-family: false !default
  4. $button-border-color: $grey-lighter !default
  5. $button-border-width: $control-border-width !default
  6. $button-padding-vertical: calc(0.375em - #{$button-border-width}) !default
  7. $button-padding-horizontal: 0.75em !default
  8. $button-hover-color: $link-hover !default
  9. $button-hover-border-color: $link-hover-border !default
  10. $button-focus-color: $link-focus !default
  11. $button-focus-border-color: $link-focus-border !default
  12. $button-focus-box-shadow-size: 0 0 0 0.125em !default
  13. $button-focus-box-shadow-color: rgba($link, 0.25) !default
  14. $button-active-color: $link-active !default
  15. $button-active-border-color: $link-active-border !default
  16. $button-text-color: $text !default
  17. $button-text-hover-background-color: $background !default
  18. $button-text-hover-color: $text-strong !default
  19. $button-disabled-background-color: $white !default
  20. $button-disabled-border-color: $grey-lighter !default
  21. $button-disabled-shadow: none !default
  22. $button-disabled-opacity: 0.5 !default
  23. $button-static-color: $grey !default
  24. $button-static-background-color: $white-ter !default
  25. $button-static-border-color: $grey-lighter !default
  26. // The button sizes use mixins so they can be used at different breakpoints
  27. =button-small
  28. border-radius: $radius-small
  29. font-size: $size-small
  30. =button-normal
  31. font-size: $size-normal
  32. =button-medium
  33. font-size: $size-medium
  34. =button-large
  35. font-size: $size-large
  36. .button
  37. @extend %control
  38. @extend %unselectable
  39. background-color: $button-background-color
  40. border-color: $button-border-color
  41. border-width: $button-border-width
  42. color: $button-color
  43. cursor: pointer
  44. @if $button-family
  45. font-family: $button-family
  46. justify-content: center
  47. padding-bottom: $button-padding-vertical
  48. padding-left: $button-padding-horizontal
  49. padding-right: $button-padding-horizontal
  50. padding-top: $button-padding-vertical
  51. text-align: center
  52. white-space: nowrap
  53. strong
  54. color: inherit
  55. .icon
  56. &,
  57. &.is-small,
  58. &.is-medium,
  59. &.is-large
  60. height: 1.5em
  61. width: 1.5em
  62. &:first-child:not(:last-child)
  63. margin-left: calc(-0.375em - #{$button-border-width})
  64. margin-right: 0.1875em
  65. &:last-child:not(:first-child)
  66. margin-left: 0.1875em
  67. margin-right: calc(-0.375em - #{$button-border-width})
  68. &:first-child:last-child
  69. margin-left: calc(-0.375em - #{$button-border-width})
  70. margin-right: calc(-0.375em - #{$button-border-width})
  71. // States
  72. &:hover,
  73. &.is-hovered
  74. border-color: $button-hover-border-color
  75. color: $button-hover-color
  76. &:focus,
  77. &.is-focused
  78. border-color: $button-focus-border-color
  79. color: $button-focus-color
  80. &:not(:active)
  81. box-shadow: $button-focus-box-shadow-size $button-focus-box-shadow-color
  82. &:active,
  83. &.is-active
  84. border-color: $button-active-border-color
  85. color: $button-active-color
  86. // Colors
  87. &.is-text
  88. background-color: transparent
  89. border-color: transparent
  90. color: $button-text-color
  91. text-decoration: underline
  92. &:hover,
  93. &.is-hovered,
  94. &:focus,
  95. &.is-focused
  96. background-color: $button-text-hover-background-color
  97. color: $button-text-hover-color
  98. &:active,
  99. &.is-active
  100. background-color: darken($button-text-hover-background-color, 5%)
  101. color: $button-text-hover-color
  102. &[disabled],
  103. fieldset[disabled] &
  104. background-color: transparent
  105. border-color: transparent
  106. box-shadow: none
  107. @each $name, $pair in $colors
  108. $color: nth($pair, 1)
  109. $color-invert: nth($pair, 2)
  110. &.is-#{$name}
  111. background-color: $color
  112. border-color: transparent
  113. color: $color-invert
  114. &:hover,
  115. &.is-hovered
  116. background-color: darken($color, 2.5%)
  117. border-color: transparent
  118. color: $color-invert
  119. &:focus,
  120. &.is-focused
  121. border-color: transparent
  122. color: $color-invert
  123. &:not(:active)
  124. box-shadow: $button-focus-box-shadow-size rgba($color, 0.25)
  125. &:active,
  126. &.is-active
  127. background-color: darken($color, 5%)
  128. border-color: transparent
  129. color: $color-invert
  130. &[disabled],
  131. fieldset[disabled] &
  132. background-color: $color
  133. border-color: transparent
  134. box-shadow: none
  135. &.is-inverted
  136. background-color: $color-invert
  137. color: $color
  138. &:hover,
  139. &.is-hovered
  140. background-color: darken($color-invert, 5%)
  141. &[disabled],
  142. fieldset[disabled] &
  143. background-color: $color-invert
  144. border-color: transparent
  145. box-shadow: none
  146. color: $color
  147. &.is-loading
  148. &::after
  149. border-color: transparent transparent $color-invert $color-invert !important
  150. &.is-outlined
  151. background-color: transparent
  152. border-color: $color
  153. color: $color
  154. &:hover,
  155. &.is-hovered,
  156. &:focus,
  157. &.is-focused
  158. background-color: $color
  159. border-color: $color
  160. color: $color-invert
  161. &.is-loading
  162. &::after
  163. border-color: transparent transparent $color $color !important
  164. &:hover,
  165. &.is-hovered,
  166. &:focus,
  167. &.is-focused
  168. &::after
  169. border-color: transparent transparent $color-invert $color-invert !important
  170. &[disabled],
  171. fieldset[disabled] &
  172. background-color: transparent
  173. border-color: $color
  174. box-shadow: none
  175. color: $color
  176. &.is-inverted.is-outlined
  177. background-color: transparent
  178. border-color: $color-invert
  179. color: $color-invert
  180. &:hover,
  181. &.is-hovered,
  182. &:focus,
  183. &.is-focused
  184. background-color: $color-invert
  185. color: $color
  186. &.is-loading
  187. &:hover,
  188. &.is-hovered,
  189. &:focus,
  190. &.is-focused
  191. &::after
  192. border-color: transparent transparent $color $color !important
  193. &[disabled],
  194. fieldset[disabled] &
  195. background-color: transparent
  196. border-color: $color-invert
  197. box-shadow: none
  198. color: $color-invert
  199. // Sizes
  200. &.is-small
  201. +button-small
  202. &.is-normal
  203. +button-normal
  204. &.is-medium
  205. +button-medium
  206. &.is-large
  207. +button-large
  208. // Modifiers
  209. &[disabled],
  210. fieldset[disabled] &
  211. background-color: $button-disabled-background-color
  212. border-color: $button-disabled-border-color
  213. box-shadow: $button-disabled-shadow
  214. opacity: $button-disabled-opacity
  215. &.is-fullwidth
  216. display: flex
  217. width: 100%
  218. &.is-loading
  219. color: transparent !important
  220. pointer-events: none
  221. &::after
  222. @extend %loader
  223. +center(1em)
  224. position: absolute !important
  225. &.is-static
  226. background-color: $button-static-background-color
  227. border-color: $button-static-border-color
  228. color: $button-static-color
  229. box-shadow: none
  230. pointer-events: none
  231. &.is-rounded
  232. border-radius: $radius-rounded
  233. padding-left: 1em
  234. padding-right: 1em
  235. .buttons
  236. align-items: center
  237. display: flex
  238. flex-wrap: wrap
  239. justify-content: flex-start
  240. .button
  241. margin-bottom: 0.5rem
  242. &:not(:last-child):not(.is-fullwidth)
  243. margin-right: 0.5rem
  244. &:last-child
  245. margin-bottom: -0.5rem
  246. &:not(:last-child)
  247. margin-bottom: 1rem
  248. // Sizes
  249. &.are-small
  250. .button:not(.is-normal):not(.is-medium):not(.is-large)
  251. +button-small
  252. &.are-medium
  253. .button:not(.is-small):not(.is-normal):not(.is-large)
  254. +button-medium
  255. &.are-large
  256. .button:not(.is-small):not(.is-normal):not(.is-medium)
  257. +button-large
  258. &.has-addons
  259. .button
  260. &:not(:first-child)
  261. border-bottom-left-radius: 0
  262. border-top-left-radius: 0
  263. &:not(:last-child)
  264. border-bottom-right-radius: 0
  265. border-top-right-radius: 0
  266. margin-right: -1px
  267. &:last-child
  268. margin-right: 0
  269. &:hover,
  270. &.is-hovered
  271. z-index: 2
  272. &:focus,
  273. &.is-focused,
  274. &:active,
  275. &.is-active,
  276. &.is-selected
  277. z-index: 3
  278. &:hover
  279. z-index: 4
  280. &.is-expanded
  281. flex-grow: 1
  282. flex-shrink: 1
  283. &.is-centered
  284. justify-content: center
  285. &:not(.has-addons)
  286. .button:not(.is-fullwidth)
  287. margin-left: 0.25rem
  288. margin-right: 0.25rem
  289. &.is-right
  290. justify-content: flex-end
  291. &:not(.has-addons)
  292. .button:not(.is-fullwidth)
  293. margin-left: 0.25rem
  294. margin-right: 0.25rem