|
9 | 9 | * |
10 | 10 | * @param $item-selector - slide items (default: direct li children) |
11 | 11 | * |
12 | | - * Custom properties (optional overrides on the scroll container): |
13 | | - * --horizontal-scroll-gap - flex gap (falls back to --column-gap) |
14 | | - * --horizontal-scroll-peek - visible part of the next slide |
| 12 | + * Custom properties (optional overrides on the scroll container, set before the include): |
| 13 | + * --horizontal-scroll-gap - flex gap (falls back to --column-gap, then theme spacing) |
| 14 | + * --horizontal-scroll-peek - visible part of the next slide (defaults to gap + xs spacing) |
15 | 15 | * |
16 | 16 | * Example: |
17 | 17 | * |
18 | 18 | * .my-track { |
19 | 19 | * @include breakpoints(sm, max) { |
| 20 | + * --horizontal-scroll-gap: var(--column-gap); |
20 | 21 | * @include horizontal-scroll-snap; |
21 | 22 | * } |
22 | 23 | * } |
23 | 24 | */ |
24 | 25 | @mixin horizontal-scroll-snap($item-selector: "> li") { |
25 | | - --horizontal-scroll-gap: #{$settings-spacing-xs}; |
26 | | - --horizontal-scroll-peek: calc(var(--horizontal-scroll-gap) + #{$settings-spacing-xs}); |
| 26 | + $_horizontal-scroll-gap: var(--horizontal-scroll-gap, var(--column-gap, #{$settings-spacing-xs})); |
| 27 | + $_horizontal-scroll-peek: var(--horizontal-scroll-peek, calc(#{$_horizontal-scroll-gap} + #{$settings-spacing-xs})); |
27 | 28 |
|
28 | 29 | display: flex; |
29 | 30 | flex-wrap: nowrap; |
30 | | - gap: var(--horizontal-scroll-gap); |
| 31 | + gap: #{$_horizontal-scroll-gap}; |
31 | 32 | width: calc(100% + var(--responsive--gutter-left) + var(--responsive--gutter-right)); |
32 | 33 | padding-inline: var(--responsive--gutter-left) var(--responsive--gutter-right); |
33 | 34 | margin-inline: calc(-1 * var(--responsive--gutter-left)) calc(-1 * var(--responsive--gutter-right)); |
|
40 | 41 | @include scrollbar-invisible; |
41 | 42 |
|
42 | 43 | #{$item-selector} { |
43 | | - flex: 0 0 calc(100% - var(--horizontal-scroll-peek)); |
| 44 | + flex: 0 0 calc(100% - #{$_horizontal-scroll-peek}); |
44 | 45 | min-width: 0; |
45 | 46 | scroll-snap-align: start; |
46 | 47 | } |
|
0 commit comments