_collapse.scss 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. // For Collapse And Accordion
  2. // For collapse-title
  3. [class*='collapse-'] {
  4. .collapse-title {
  5. font-weight: 500;
  6. font-size: 1.1rem;
  7. }
  8. .card {
  9. margin-bottom: 0;
  10. &:last-of-type {
  11. margin-bottom: 0;
  12. }
  13. &:not(:last-of-type) {
  14. border-bottom: 1px solid $border-color;
  15. }
  16. .card-header {
  17. cursor: pointer;
  18. padding: 1rem 2.8rem 1rem 1rem;
  19. }
  20. .card-body {
  21. padding: 1rem;
  22. line-height: 1.5;
  23. padding-top: 0.42rem;
  24. }
  25. }
  26. }
  27. // For collapse title
  28. .collapse-title {
  29. color: inherit;
  30. &:hover {
  31. color: inherit;
  32. }
  33. }
  34. // To add a border below collapse/accordion heading
  35. .collapse-default {
  36. .card:first-child {
  37. border-top: 0;
  38. }
  39. .card:last-child {
  40. border-bottom: 0;
  41. }
  42. .card {
  43. border-radius: 0;
  44. }
  45. }
  46. // For Collapse with border
  47. .collapse-border {
  48. .card {
  49. border: 1px solid $border-color;
  50. &:not(:last-of-type) {
  51. border-bottom: 0;
  52. border-bottom-right-radius: 0;
  53. border-bottom-left-radius: 0;
  54. }
  55. &:not(:first-of-type) {
  56. border-top-left-radius: 0;
  57. border-top-right-radius: 0;
  58. }
  59. }
  60. }
  61. // For Collapse with shadow
  62. .collapse-shadow {
  63. box-shadow: 0 0px 4px 0 rgba($black, 0.1);
  64. padding: 0.15rem 0.75rem;
  65. border-radius: $border-radius;
  66. .card {
  67. border-radius: 0;
  68. transition: border 0.5s ease-in-out, all 0.3s ease-in-out;
  69. &.open {
  70. border-radius: 0.571rem;
  71. margin: 10px 0;
  72. border: 0;
  73. box-shadow: 0px 0px 8px 0px rgba($black, 0.1) !important;
  74. }
  75. }
  76. .card:first-child {
  77. border-top-left-radius: 0.571rem;
  78. border-top-right-radius: 0.571rem;
  79. }
  80. .card:last-child {
  81. border-bottom-left-radius: 0.571rem;
  82. border-bottom-right-radius: 0.571rem;
  83. }
  84. }
  85. // For Collapse with margin
  86. .collapse-margin {
  87. .card {
  88. margin-top: 0.71rem;
  89. margin-bottom: 0.71rem;
  90. box-shadow: 0 2px 15px 0 rgba($black, 0.05) !important;
  91. border-radius: 0.358rem;
  92. border-bottom: 0 solid transparent !important;
  93. }
  94. .card-header {
  95. border-radius: 0.358rem;
  96. }
  97. }
  98. // Collapse Icon & Animation
  99. .collapse-icon {
  100. .card-header {
  101. position: relative;
  102. }
  103. [data-toggle='collapse'] {
  104. &:after {
  105. position: absolute;
  106. top: 58%;
  107. right: 1rem;
  108. margin-top: -8px;
  109. background-image: url(str-replace(str-replace($chevron-down, 'currentColor', $body-color), '#', '%23'));
  110. background-repeat: no-repeat;
  111. background-position: center;
  112. background-size: 14px;
  113. width: 14px;
  114. height: 11px;
  115. content: '';
  116. transition: all 300ms linear 0s;
  117. }
  118. &:disabled {
  119. &:before {
  120. background-image: url(str-replace(str-replace($chevron-up, 'currentColor', $body-color), '#', '%23'));
  121. }
  122. }
  123. }
  124. [aria-expanded='false'] {
  125. &:after {
  126. transform: rotate(-180deg);
  127. }
  128. }
  129. }