_ribbons.scss 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. // stylelint-disable declaration-no-important
  2. .ribbon {
  3. --#{$prefix}ribbon-margin: #{$card-ribbon-margin};
  4. --#{$prefix}ribbon-border-radius: #{$card-ribbon-border-radius};
  5. position: absolute;
  6. top: .75rem;
  7. right: calc(-1 * var(--#{$prefix}ribbon-margin));
  8. z-index: 1;
  9. padding: .25rem .75rem;
  10. font-size: $card-ribbon-font-size;
  11. font-weight: var(--#{$prefix}font-weight-bold);
  12. line-height: 1;
  13. color: $white;
  14. text-align: center;
  15. text-transform: uppercase;
  16. background: var(--#{$prefix}primary);
  17. border-color: var(--#{$prefix}primary);
  18. border-radius: var(--#{$prefix}ribbon-border-radius) 0 var(--#{$prefix}ribbon-border-radius) var(--#{$prefix}ribbon-border-radius);
  19. display: inline-flex;
  20. align-items: center;
  21. justify-content: center;
  22. min-height: 2rem;
  23. min-width: 2rem;
  24. &:before {
  25. position: absolute;
  26. right: 0;
  27. bottom: 100%;
  28. width: 0;
  29. height: 0;
  30. content: "";
  31. filter: brightness(70%);
  32. border: calc(var(--#{$prefix}ribbon-margin) * .5) var(--#{$prefix}border-style);
  33. border-color: inherit;
  34. border-top-color: transparent;
  35. border-right-color: transparent;
  36. }
  37. @if $enable-extra-colors {
  38. @each $color, $value in $extra-colors {
  39. &.bg-#{$color} {
  40. border-color: var(--#{$prefix}#{$color});
  41. }
  42. &.bg-#{$color}-lt {
  43. border-color: rgba(var(--#{$prefix}#{$color}-rgb), .1) !important;
  44. }
  45. }
  46. }
  47. .icon {
  48. width: 1.25rem;
  49. height: 1.25rem;
  50. font-size: 1.25rem;
  51. }
  52. }
  53. .ribbon-top {
  54. top: calc(-1 * var(--#{$prefix}ribbon-margin));
  55. right: .75rem;
  56. width: 2rem;
  57. padding: .5rem 0;
  58. border-radius: 0 var(--#{$prefix}ribbon-border-radius) var(--#{$prefix}ribbon-border-radius) var(--#{$prefix}ribbon-border-radius);
  59. &:before {
  60. top: 0;
  61. right: 100%;
  62. bottom: auto;
  63. border-color: inherit;
  64. border-top-color: transparent;
  65. border-left-color: transparent;
  66. }
  67. &.ribbon-start {
  68. right: auto;
  69. left: .75rem;
  70. &:before {
  71. top: 0;
  72. right: 100%;
  73. left: auto;
  74. }
  75. }
  76. }
  77. .ribbon-start {
  78. right: auto;
  79. left: calc(-1 * var(--#{$prefix}ribbon-margin));
  80. border-radius: 0 var(--#{$prefix}ribbon-border-radius) var(--#{$prefix}ribbon-border-radius) var(--#{$prefix}ribbon-border-radius);
  81. &:before {
  82. top: auto;
  83. bottom: 100%;
  84. left: 0;
  85. border-color: inherit;
  86. border-top-color: transparent;
  87. border-left-color: transparent;
  88. }
  89. }
  90. .ribbon-bottom {
  91. top: auto;
  92. bottom: .75rem;
  93. }
  94. .ribbon-bookmark {
  95. padding-left: .25rem;
  96. border-radius: 0 0 var(--#{$prefix}ribbon-border-radius) 0;
  97. &:after {
  98. position: absolute;
  99. top: 0;
  100. right: 100%;
  101. display: block;
  102. width: 0;
  103. height: 0;
  104. content: "";
  105. border: 1rem var(--#{$prefix}border-style);
  106. border-color: inherit;
  107. border-right-width: 0;
  108. border-left-color: transparent;
  109. border-left-width: .5rem;
  110. }
  111. &.ribbon-left {
  112. padding-right: .5rem;
  113. &:after {
  114. right: auto;
  115. left: 100%;
  116. border-right-color: transparent;
  117. border-right-width: .5rem;
  118. border-left-width: 0;
  119. }
  120. }
  121. &.ribbon-top {
  122. padding-right: 0;
  123. padding-bottom: .25rem;
  124. padding-left: 0;
  125. border-radius: 0 var(--#{$prefix}ribbon-border-radius) 0 0;
  126. &:after {
  127. top: 100%;
  128. right: 0;
  129. left: 0;
  130. border-color: inherit;
  131. border-width: 1rem;
  132. border-top-width: 0;
  133. border-bottom-color: transparent;
  134. border-bottom-width: .5rem;
  135. }
  136. }
  137. }