Lightweight CSS Framework for Building Apps and Websites https://crispy-css.com
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.

105 lines
1.8 KiB

  1. /**
  2. * icon
  3. *
  4. * use svg as icon
  5. *
  6. * <svg class="icon">
  7. * <use src="#"></use>
  8. * </svg>
  9. *
  10. *
  11. * @author Björn Hase
  12. *
  13. */
  14. $icon__vertical-align: middle !default;
  15. $icon__margin: 0 2px !default;
  16. // width & height
  17. $icon__sizes: (
  18. 'default': 18px,
  19. 'small': 14px,
  20. 'large': 28px
  21. ) !default;
  22. // colors
  23. $icon__colors: (
  24. 'default' : black,
  25. 'secondary' : grey,
  26. ) !default;
  27. @mixin crispy-boilerplate-icon() {
  28. .icon {
  29. display: inline-block;
  30. position: relative;
  31. vertical-align: $icon__vertical-align;
  32. margin: $icon__margin;
  33. @include crispy-boilerplate-icon-colors($icon__colors);
  34. @include crispy-boilerplate-icon-sizes($icon__sizes);
  35. @content;
  36. }
  37. }
  38. /**
  39. * add modificators for icons as fill from map
  40. *
  41. *
  42. * @param {map} $colors
  43. *
  44. */
  45. @mixin crispy-boilerplate-icon-colors($colors) {
  46. @each $name, $color in $colors {
  47. @if ($name == 'default') {
  48. @include crispy-boilerplate-icon-color($color);
  49. } @else {
  50. &--#{$name} {
  51. @include crispy-boilerplate-icon-color($color);
  52. }
  53. }
  54. }
  55. }
  56. /**
  57. * add color as fill
  58. *
  59. *
  60. * @param {color} $color
  61. *
  62. */
  63. @mixin crispy-boilerplate-icon-color($color) {
  64. fill: $color;
  65. }
  66. /**
  67. * adding sizes for icons from map
  68. *
  69. *
  70. * @param {map} $sizes
  71. *
  72. */
  73. @mixin crispy-boilerplate-icon-sizes($sizes) {
  74. @each $name, $size in $sizes {
  75. @if ($name == 'default') {
  76. @include crispy-boilerplate-icon-size($size);
  77. } @else {
  78. &--#{$name} {
  79. @include crispy-boilerplate-icon-size($size);
  80. }
  81. }
  82. }
  83. }
  84. /**
  85. * add size for icon as width and height
  86. *
  87. *
  88. * @param {px} $size
  89. *
  90. */
  91. @mixin crispy-boilerplate-icon-size($size) {
  92. width: $size;
  93. height: $size;
  94. }