_boxes.scss 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. // Boxes on the home page and similar: .td-box
  2. // box-variant creates the main style for a colored section
  3. @mixin box-variant($parent, $color-name, $color-value) {
  4. $text-color: color-contrast($color-value);
  5. $link-color: mix($blue, $text-color, lightness($color-value));
  6. $link-hover-color: if(
  7. color-contrast($link-color) == $color-contrast-light,
  8. shade-color($link-color, $link-shade-percentage),
  9. tint-color($link-color, $link-shade-percentage)
  10. );
  11. #{$parent} {
  12. &--#{$color-name} {
  13. color: $text-color;
  14. background-color: #{$color-value};
  15. .td-arrow-down {
  16. &::before {
  17. left: 50%;
  18. margin-left: -30px;
  19. bottom: -25px;
  20. border: {
  21. style: solid;
  22. width: 25px 30px 0 30px;
  23. color: #{$color-value} transparent transparent transparent;
  24. }
  25. z-index: 3;
  26. position: absolute;
  27. content: "";
  28. }
  29. }
  30. }
  31. }
  32. // Improve contrast for the links in paragraphs.
  33. @include link-variant(
  34. "#{$parent}--#{$color-name} p > a, #{$parent}--#{$color-name} span > a",
  35. $link-color,
  36. $link-hover-color,
  37. false
  38. );
  39. }
  40. // Common min-height modifiers used for boxes.
  41. @mixin td-box-height-modifiers($parent) {
  42. #{$parent} {
  43. &--height-min {
  44. min-height: 300px;
  45. }
  46. &--height-med {
  47. min-height: 400px;
  48. }
  49. &--height-max {
  50. min-height: 500px;
  51. }
  52. &--height-full {
  53. min-height: 100vh;
  54. }
  55. @include media-breakpoint-up(md) {
  56. &--height-min {
  57. min-height: 450px;
  58. }
  59. &--height-med {
  60. min-height: 500px;
  61. }
  62. &--height-max {
  63. min-height: 650px;
  64. }
  65. }
  66. }
  67. }
  68. @include td-box-height-modifiers(".td-box");
  69. // Styling for section boxes
  70. .td-box {
  71. .row {
  72. padding-left: 5vw;
  73. padding-right: 5vw;
  74. }
  75. table {
  76. @extend .td-table;
  77. }
  78. }
  79. // Styling for community page link boxes
  80. .td-box.linkbox {
  81. padding: 5vh 5vw;
  82. }
  83. // This allows "painting by numbers"
  84. @for $i from 1 through length($td-box-colors) {
  85. $c: nth($td-box-colors, $i);
  86. $name: $i - 1;
  87. @include box-variant(".td-box", $name, $c);
  88. }
  89. // Same as above with all the theme color names.
  90. @each $color, $value in $colors {
  91. @include box-variant(".td-box", $color, $value);
  92. }
  93. @each $color, $value in $theme-colors {
  94. @include box-variant(".td-box", $color, $value);
  95. }
  96. @each $color, $value in $grays {
  97. @include box-variant(".td-box", $color, $value);
  98. }
  99. // Single dark-mode compatibility override for white boxes:
  100. @include color-mode(dark) {
  101. .td-box--white {
  102. color: var(--bs-body-color);
  103. background-color: var(--bs-body-bg);
  104. p > a, span > a {
  105. color: var(--bs-link-color);
  106. &:focus,
  107. &:hover {
  108. color: rgba(var(--bs-link-color-rgb), var(--bs-link-opacity, 1));
  109. }
  110. }
  111. .td-arrow-down::before {
  112. border-color: var(--bs-body-bg) transparent transparent transparent;
  113. }
  114. }
  115. }