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 7.5KB

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