_icon-bar.scss 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. // Foundation by ZURB
  2. // foundation.zurb.com
  3. // Licensed under MIT Open Source
  4. @import "global";
  5. // @name
  6. // @dependencies _global.scss
  7. $include-html-icon-bar-classes: $include-html-classes !default;
  8. // @variables
  9. // We use these to style the icon-bar and items
  10. $icon-bar-bg: $oil !default;
  11. $icon-bar-font-color: $white !default;
  12. $icon-bar-font-color-hover: $icon-bar-font-color !default;
  13. $icon-bar-font-size: 1rem !default;
  14. $icon-bar-hover-color: $primary-color !default;
  15. $icon-bar-icon-color: $white !default;
  16. $icon-bar-icon-color-hover: $icon-bar-icon-color !default;
  17. $icon-bar-icon-size: 1.875rem !default;
  18. $icon-bar-image-width: 1.875rem !default;
  19. $icon-bar-image-height: 1.875rem !default;
  20. $icon-bar-active-color: $primary-color !default;
  21. $icon-bar-item-padding: 1.25rem !default;
  22. // We use this to set default opacity and cursor for disabled icons.
  23. $icon-bar-disabled-opacity: 0.7 !default;
  24. $icon-bar-disabled-cursor: $cursor-disabled-value !default;
  25. //
  26. // @mixins
  27. //
  28. // We use this mixin to create the base styles for our Icon bar element.
  29. //
  30. @mixin icon-bar-base() {
  31. width: 100%;
  32. font-size: 0;
  33. display: inline-block;
  34. & > * {
  35. text-align: center;
  36. font-size: $icon-bar-font-size;
  37. width: 25%;
  38. margin: 0 auto;
  39. display: block;
  40. padding: $icon-bar-item-padding;
  41. float: left;
  42. i, img {
  43. display: block;
  44. margin: 0 auto;
  45. & + label {
  46. margin-top: .0625rem;
  47. }
  48. }
  49. i {
  50. font-size: $icon-bar-icon-size;
  51. vertical-align: middle;
  52. }
  53. img {
  54. width: $icon-bar-image-width;
  55. height: $icon-bar-image-height;
  56. }
  57. }
  58. &.label-right > * {
  59. i, img {
  60. margin: 0 .0625rem 0 0;
  61. display: inline-block;
  62. & + label {
  63. margin-top: 0;
  64. }
  65. }
  66. label { display: inline-block; }
  67. }
  68. &.vertical.label-right > * {
  69. text-align: left;
  70. }
  71. &.vertical, &.small-vertical{
  72. height: 100%;
  73. width: auto;
  74. .item {
  75. width: auto;
  76. margin: auto;
  77. float: none;
  78. }
  79. }
  80. &.medium-vertical {
  81. @media #{$medium-up} {
  82. height: 100%;
  83. width: auto;
  84. .item {
  85. width: auto;
  86. margin: auto;
  87. float: none;
  88. }
  89. }
  90. }
  91. &.large-vertical {
  92. @media #{$large-up} {
  93. height: 100%;
  94. width: auto;
  95. .item {
  96. width: auto;
  97. margin: auto;
  98. float: none;
  99. }
  100. }
  101. }
  102. }
  103. // We use this mixin to create the size styles for icon bars.
  104. @mixin icon-bar-size(
  105. $padding: $icon-bar-item-padding,
  106. $font-size: $icon-bar-font-size,
  107. $icon-size: $icon-bar-icon-size,
  108. $image-width: $icon-bar-image-width,
  109. $image-height: $icon-bar-image-height) {
  110. & > * {
  111. font-size: $font-size;
  112. padding: $padding;
  113. i, img {
  114. & + label {
  115. margin-top: .0625rem;
  116. }
  117. }
  118. i {
  119. font-size: $icon-size;
  120. }
  121. img {
  122. width: $image-width;
  123. height: $image-height;
  124. }
  125. }
  126. }
  127. @mixin icon-bar-style(
  128. $bar-bg:$icon-bar-bg,
  129. $bar-font-color:$icon-bar-font-color,
  130. $bar-font-color-hover:$icon-bar-font-color-hover,
  131. $bar-hover-color:$icon-bar-hover-color,
  132. $bar-icon-color:$icon-bar-icon-color,
  133. $bar-icon-color-hover:$icon-bar-icon-color-hover,
  134. $bar-active-color:$icon-bar-active-color,
  135. $base-style:true,
  136. $disabled:false) {
  137. @if $base-style {
  138. background: $bar-bg;
  139. & > * {
  140. label { color: $bar-font-color; }
  141. i { color: $bar-icon-color; }
  142. }
  143. & > a:hover {
  144. background: $bar-hover-color;
  145. label { color: $bar-font-color-hover; }
  146. i { color: $bar-icon-color-hover; }
  147. }
  148. & > a.active {
  149. background: $bar-active-color;
  150. label { color: $bar-font-color-hover; }
  151. i { color: $bar-icon-color-hover; }
  152. }
  153. }
  154. @if $disabled {
  155. .item.disabled {
  156. opacity: $icon-bar-disabled-opacity;
  157. cursor: $icon-bar-disabled-cursor;
  158. pointer-events: none;
  159. >* {
  160. opacity: $icon-bar-disabled-opacity;
  161. cursor: $icon-bar-disabled-cursor;
  162. }
  163. }
  164. }
  165. }
  166. // We use this to quickly create icon bars with a single mixin
  167. // $height - The overall calculated height of the icon bar (horizontal)
  168. // $bar-bg - the background color of the bar
  169. // $bar-font-color - the font color
  170. // $bar-hover-color - okay these are pretty obvious variables
  171. // $bar-icon-color - maybe we could skip explaining them all? Okay this one does change icon color if you use an icon font
  172. // $bar-active-color - the color of an active / hover state
  173. // $base-style - Apply base styles? Default: true.
  174. // $disabled - Allow disabled icons? Default: false.
  175. @mixin icon-bar(
  176. $bar-bg:$icon-bar-bg,
  177. $bar-font-color:$icon-bar-font-color,
  178. $bar-font-color-hover:$icon-bar-font-color-hover,
  179. $bar-hover-color:$icon-bar-hover-color,
  180. $bar-icon-color:$icon-bar-icon-color,
  181. $bar-icon-color-hover:$icon-bar-icon-color-hover,
  182. $bar-active-color:$icon-bar-active-color,
  183. $padding: $icon-bar-item-padding,
  184. $font-size: $icon-bar-font-size,
  185. $icon-size: $icon-bar-icon-size,
  186. $image-width: $icon-bar-image-width,
  187. $image-height: $icon-bar-image-height,
  188. $base-style:true,
  189. $disabled:true) {
  190. @include icon-bar-base();
  191. @include icon-bar-size($padding, $font-size, $icon-size, $image-width, $image-height);
  192. @include icon-bar-style($bar-bg, $bar-font-color, $bar-font-color-hover, $bar-hover-color, $bar-icon-color, $bar-icon-color-hover, $bar-active-color, $base-style, $disabled);
  193. }
  194. @include exports("icon-bar") {
  195. @if $include-html-icon-bar-classes {
  196. .icon-bar {
  197. @include icon-bar;
  198. }
  199. }
  200. }
  201. @if $include-html-icon-bar-classes {
  202. // toolbar styles
  203. .icon-bar {
  204. // Counts
  205. &.two-up {
  206. .item { width: 50%; }
  207. &.vertical .item, &.small-vertical .item { width: auto; }
  208. &.medium-vertical .item {
  209. @media #{$medium-up} {
  210. width: auto;
  211. }
  212. }
  213. &.large-vertical .item {
  214. @media #{$large-up} {
  215. width: auto;
  216. }
  217. }
  218. }
  219. &.three-up {
  220. .item { width: 33.3333%; }
  221. &.vertical .item, &.small-vertical .item { width: auto; }
  222. &.medium-vertical .item {
  223. @media #{$medium-up} {
  224. width: auto;
  225. }
  226. }
  227. &.large-vertical .item {
  228. @media #{$large-up} {
  229. width: auto;
  230. }
  231. }
  232. }
  233. &.four-up {
  234. .item { width: 25%; }
  235. &.vertical .item, &.small-vertical .item { width: auto; }
  236. &.medium-vertical .item {
  237. @media #{$medium-up} {
  238. width: auto;
  239. }
  240. }
  241. &.large-vertical .item {
  242. @media #{$large-up} {
  243. width: auto;
  244. }
  245. }
  246. }
  247. &.five-up {
  248. .item { width: 20%; }
  249. &.vertical .item, &.small-vertical .item { width: auto; }
  250. &.medium-vertical .item {
  251. @media #{$medium-up} {
  252. width: auto;
  253. }
  254. }
  255. &.large-vertical .item {
  256. @media #{$large-up} {
  257. width: auto;
  258. }
  259. }
  260. }
  261. &.six-up {
  262. .item { width: 16.66667%; }
  263. &.vertical .item, &.small-vertical .item { width: auto; }
  264. &.medium-vertical .item {
  265. @media #{$medium-up} {
  266. width: auto;
  267. }
  268. }
  269. &.large-vertical .item {
  270. @media #{$large-up} {
  271. width: auto;
  272. }
  273. }
  274. }
  275. &.seven-up {
  276. .item { width: 14.28571%; }
  277. &.vertical .item, &.small-vertical .item { width: auto; }
  278. &.medium-vertical .item {
  279. @media #{$medium-up} {
  280. width: auto;
  281. }
  282. }
  283. &.large-vertical .item {
  284. @media #{$large-up} {
  285. width: auto;
  286. }
  287. }
  288. }
  289. &.eight-up {
  290. .item { width: 12.5%; }
  291. &.vertical .item, &.small-vertical .item { width: auto; }
  292. &.medium-vertical .item {
  293. @media #{$medium-up} {
  294. width: auto;
  295. }
  296. }
  297. &.large-vertical .item {
  298. @media #{$large-up} {
  299. width: auto;
  300. }
  301. }
  302. }
  303. }
  304. }