Skip to content

Commit dd2ed26

Browse files
committed
fix bugbot : enhance horizontal scroll snap mixin with improved custom property handling
1 parent 5c9164b commit dd2ed26

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

‎src/scss/02-tools/_m-horizontal-scroll-snap.scss‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,25 +9,26 @@
99
*
1010
* @param $item-selector - slide items (default: direct li children)
1111
*
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)
1515
*
1616
* Example:
1717
*
1818
* .my-track {
1919
* @include breakpoints(sm, max) {
20+
* --horizontal-scroll-gap: var(--column-gap);
2021
* @include horizontal-scroll-snap;
2122
* }
2223
* }
2324
*/
2425
@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}));
2728

2829
display: flex;
2930
flex-wrap: nowrap;
30-
gap: var(--horizontal-scroll-gap);
31+
gap: #{$_horizontal-scroll-gap};
3132
width: calc(100% + var(--responsive--gutter-left) + var(--responsive--gutter-right));
3233
padding-inline: var(--responsive--gutter-left) var(--responsive--gutter-right);
3334
margin-inline: calc(-1 * var(--responsive--gutter-left)) calc(-1 * var(--responsive--gutter-right));
@@ -40,7 +41,7 @@
4041
@include scrollbar-invisible;
4142

4243
#{$item-selector} {
43-
flex: 0 0 calc(100% - var(--horizontal-scroll-peek));
44+
flex: 0 0 calc(100% - #{$_horizontal-scroll-peek});
4445
min-width: 0;
4546
scroll-snap-align: start;
4647
}

0 commit comments

Comments
 (0)