|
| 1 | +/** |
| 2 | + * This file should be in sync with: https://github.com/moodle/moodle/blob/main/theme/boost/scss/moodle/bs5-bridge.scss |
| 3 | + * This is partially done as part of https://tracker.moodle.org/browse/MDL-71979. |
| 4 | + */ |
| 5 | + |
| 6 | + /* Bootstrap 5 bridge classes */ |
| 7 | + |
| 8 | + |
| 9 | +/* |
| 10 | + * These function used to bridge the gap between Bootstrap 4 and Bootstrap 5 and |
| 11 | + * and will be located in __functions.scss in Bootstrap 5 |
| 12 | + */ |
| 13 | + |
| 14 | +// Tint a color: mix a color with white based on the provided weight. |
| 15 | +@function tint-color($color, $weight) { |
| 16 | + @return mix(white, $color, $weight); |
| 17 | +} |
| 18 | + |
| 19 | +// Shade a color: mix a color with black. |
| 20 | +// This function darkens a given color with black based on the provided weight. |
| 21 | +@function shade-color($color, $weight) { |
| 22 | + @return mix(black, $color, $weight); |
| 23 | +} |
| 24 | + |
| 25 | +// Shade the color if the weight is positive, else tint it. |
| 26 | +@function shift-color($color, $weight) { |
| 27 | + @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight)); |
| 28 | +} |
| 29 | + |
| 30 | +/* These classes are used to bridge the gap between Bootstrap 4 and Bootstrap 5. */ |
| 31 | +/* This file should be removed as part of MDL-75669. */ |
| 32 | +.g-0 { |
| 33 | + @extend .no-gutters; |
| 34 | +} |
| 35 | + |
| 36 | +.btn-close { |
| 37 | + @extend .close; |
| 38 | +} |
| 39 | + |
| 40 | +// Generate all spacer classes for all breakpoints for directions start and end. |
| 41 | +// ps-1 > pl-1, pe-1 > pr-1, me-sm-1 > ml-sm-1, ... |
| 42 | +@each $breakpoint in map-keys($grid-breakpoints) { |
| 43 | + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); |
| 44 | + @each $prop, $abbrev in (margin: m, padding: p) { |
| 45 | + @each $size, $length in $spacers { |
| 46 | + .#{$abbrev}s#{$infix}-#{$size} { |
| 47 | + @extend .#{$abbrev}l#{$infix}-#{$size}; |
| 48 | + } |
| 49 | + .#{$abbrev}e#{$infix}-#{$size} { |
| 50 | + @extend .#{$abbrev}r#{$infix}-#{$size}; |
| 51 | + } |
| 52 | + } |
| 53 | + } |
| 54 | +} |
| 55 | + |
| 56 | +// Generate all margin auto classes for all breakpoints for directions start and end. |
| 57 | +// ps-auto > pl-auto, pe-auto > pr-auto, me-sm-auto > ml-sm-auto, ... |
| 58 | +@each $breakpoint in map-keys($grid-breakpoints) { |
| 59 | + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); |
| 60 | + .ms#{$infix}-auto { |
| 61 | + @extend .ml#{$infix}-auto; |
| 62 | + } |
| 63 | + .me#{$infix}-auto { |
| 64 | + @extend .mr#{$infix}-auto; |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +// Generate all float classes for all breakpoints for directions start and end. |
| 69 | +// float-start > float-left, float-sm-end > float-sm-right, ... |
| 70 | +@each $breakpoint in map-keys($grid-breakpoints) { |
| 71 | + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); |
| 72 | + .float#{$infix}-start { |
| 73 | + @extend .float#{$infix}-left; |
| 74 | + } |
| 75 | + .float#{$infix}-end { |
| 76 | + @extend .float#{$infix}-right; |
| 77 | + } |
| 78 | +} |
| 79 | + |
| 80 | +// Generate all text classes for all breakpoints for directions start and end. |
| 81 | +// text-start > text-left, text-sm-end > text-sm-right, ... |
| 82 | +@each $breakpoint in map-keys($grid-breakpoints) { |
| 83 | + $infix: breakpoint-infix($breakpoint, $grid-breakpoints); |
| 84 | + .text#{$infix}-start { |
| 85 | + @extend .text#{$infix}-left; |
| 86 | + } |
| 87 | + .text#{$infix}-end { |
| 88 | + @extend .text#{$infix}-right; |
| 89 | + } |
| 90 | +} |
| 91 | + |
| 92 | +.border-start { |
| 93 | + @extend .border-left; |
| 94 | +} |
| 95 | +.border-end { |
| 96 | + @extend .border-right; |
| 97 | +} |
| 98 | +.border-start-0 { |
| 99 | + @extend .border-left-0; |
| 100 | +} |
| 101 | +.border-end-0 { |
| 102 | + @extend .border-right-0; |
| 103 | +} |
| 104 | +.rounded-start { |
| 105 | + @extend .rounded-left; |
| 106 | +} |
| 107 | +.rounded-end { |
| 108 | + @extend .rounded-right; |
| 109 | +} |
0 commit comments