Skip to content

Commit

Permalink
removes the padding right when there is no scroll active. (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiCO2k authored May 9, 2024
1 parent 7190f4a commit 5ea0340
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
13 changes: 13 additions & 0 deletions resources/css/pulse.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@
[x-cloak] {
display: none;
}

@keyframes detect-scroll {
from, to { --can-scroll: ; }
}

@supports selector(::-webkit-scrollbar) {
.supports-scrollbars {
animation: detect-scroll linear;
animation-timeline: scroll(self);

padding-right: var(--can-scroll) theme('spacing.3');
}
}
2 changes: 1 addition & 1 deletion resources/views/components/scroll.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}"
{{ $attributes->merge(['class' => '@container/scroll-wrapper flex-grow flex w-full overflow-hidden' . ($expand ? '' : ' basis-56'), ':class' => "loading && 'opacity-25 animate-pulse'"]) }}
>
<div x-ref="content" class="flex-grow basis-full overflow-y-auto scrollbar:w-1.5 scrollbar:h-1.5 scrollbar:bg-transparent scrollbar-track:bg-gray-100 scrollbar-thumb:rounded scrollbar-thumb:bg-gray-300 scrollbar-track:rounded dark:scrollbar-track:bg-gray-500/10 dark:scrollbar-thumb:bg-gray-500/50 supports-scrollbars:pr-3" @scroll.debounce.5ms="scroll">
<div x-ref="content" class="flex-grow basis-full overflow-y-auto scrollbar:w-1.5 scrollbar:h-1.5 scrollbar:bg-transparent scrollbar-track:bg-gray-100 scrollbar-thumb:rounded scrollbar-thumb:bg-gray-300 scrollbar-track:rounded dark:scrollbar-track:bg-gray-500/10 dark:scrollbar-thumb:bg-gray-500/50 supports-scrollbars" @scroll.debounce.5ms="scroll">
{{ $slot }}
<div x-ref="fade" class="h-6 origin-bottom fixed bottom-0 left-0 right-0 bg-gradient-to-t from-white dark:from-gray-900 pointer-events-none" wire:ignore></div>
</div>
Expand Down
1 change: 0 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ module.exports = {
require("@tailwindcss/container-queries"),
function ({ addVariant }) {
addVariant('default', 'html :where(&)')
addVariant('supports-scrollbars', '@supports selector(::-webkit-scrollbar)'),
addVariant('scrollbar', '&::-webkit-scrollbar')
addVariant('scrollbar-track', '&::-webkit-scrollbar-track')
addVariant('scrollbar-thumb', '&::-webkit-scrollbar-thumb')
Expand Down

0 comments on commit 5ea0340

Please sign in to comment.