tag.sass 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. $tag-background-color: $background !default
  2. $tag-color: $text !default
  3. $tag-radius: $radius !default
  4. $tag-delete-margin: 1px !default
  5. .tags
  6. align-items: center
  7. display: flex
  8. flex-wrap: wrap
  9. justify-content: flex-start
  10. .tag
  11. margin-bottom: 0.5rem
  12. &:not(:last-child)
  13. margin-right: 0.5rem
  14. &:last-child
  15. margin-bottom: -0.5rem
  16. &:not(:last-child)
  17. margin-bottom: 1rem
  18. // Sizes
  19. &.are-medium
  20. .tag:not(.is-normal):not(.is-large)
  21. font-size: $size-normal
  22. &.are-large
  23. .tag:not(.is-normal):not(.is-medium)
  24. font-size: $size-medium
  25. &.is-centered
  26. justify-content: center
  27. .tag
  28. margin-right: 0.25rem
  29. margin-left: 0.25rem
  30. &.is-right
  31. justify-content: flex-end
  32. .tag
  33. &:not(:first-child)
  34. margin-left: 0.5rem
  35. &:not(:last-child)
  36. margin-right: 0
  37. &.has-addons
  38. .tag
  39. margin-right: 0
  40. &:not(:first-child)
  41. margin-left: 0
  42. border-bottom-left-radius: 0
  43. border-top-left-radius: 0
  44. &:not(:last-child)
  45. border-bottom-right-radius: 0
  46. border-top-right-radius: 0
  47. .tag:not(body)
  48. align-items: center
  49. background-color: $tag-background-color
  50. border-radius: $tag-radius
  51. color: $tag-color
  52. display: inline-flex
  53. font-size: $size-small
  54. height: 2em
  55. justify-content: center
  56. line-height: 1.5
  57. padding-left: 0.75em
  58. padding-right: 0.75em
  59. white-space: nowrap
  60. .delete
  61. margin-left: 0.25rem
  62. margin-right: -0.375rem
  63. // Colors
  64. @each $name, $pair in $colors
  65. $color: nth($pair, 1)
  66. $color-invert: nth($pair, 2)
  67. &.is-#{$name}
  68. background-color: $color
  69. color: $color-invert
  70. // Sizes
  71. &.is-normal
  72. font-size: $size-small
  73. &.is-medium
  74. font-size: $size-normal
  75. &.is-large
  76. font-size: $size-medium
  77. .icon
  78. &:first-child:not(:last-child)
  79. margin-left: -0.375em
  80. margin-right: 0.1875em
  81. &:last-child:not(:first-child)
  82. margin-left: 0.1875em
  83. margin-right: -0.375em
  84. &:first-child:last-child
  85. margin-left: -0.375em
  86. margin-right: -0.375em
  87. // Modifiers
  88. &.is-delete
  89. margin-left: $tag-delete-margin
  90. padding: 0
  91. position: relative
  92. width: 2em
  93. &::before,
  94. &::after
  95. background-color: currentColor
  96. content: ""
  97. display: block
  98. left: 50%
  99. position: absolute
  100. top: 50%
  101. transform: translateX(-50%) translateY(-50%) rotate(45deg)
  102. transform-origin: center center
  103. &::before
  104. height: 1px
  105. width: 50%
  106. &::after
  107. height: 50%
  108. width: 1px
  109. &:hover,
  110. &:focus
  111. background-color: darken($tag-background-color, 5%)
  112. &:active
  113. background-color: darken($tag-background-color, 10%)
  114. &.is-rounded
  115. border-radius: $radius-rounded
  116. a.tag
  117. &:hover
  118. text-decoration: underline