tag.sass 2.5 KB

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