chore: animated scrollbar

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-08-06 22:42:35 +08:00
parent 1118870c9e
commit f9285e2a5a
3 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -118,7 +118,6 @@
"sonner": "^1.5.0",
"swiper": "11.1.8",
"tailwind-merge": "2.4.0",
"tailwindcss-animate": "1.0.7",
"tldts": "6.1.35",
"unified": "11.0.5",
"usehooks-ts": "3.1.0",
@@ -165,6 +164,7 @@
"rollup-plugin-visualizer": "5.12.0",
"simple-git-hooks": "2.11.1",
"tailwindcss": "3.4.7",
"tailwindcss-animate": "1.0.7",
"typescript": "^5.5.4",
"vite": "^5.3.4",
"vite-plugin-mkcert": "1.17.5",
+3 -3
View File
@@ -283,9 +283,6 @@ importers:
tailwind-merge:
specifier: 2.4.0
version: 2.4.0
tailwindcss-animate:
specifier: 1.0.7
version: 1.0.7(tailwindcss@3.4.7)
tldts:
specifier: 6.1.35
version: 6.1.35
@@ -419,6 +416,9 @@ importers:
tailwindcss:
specifier: 3.4.7
version: 3.4.7
tailwindcss-animate:
specifier: 1.0.7
version: 1.0.7(tailwindcss@3.4.7)
typescript:
specifier: ^5.5.4
version: 5.5.4
@@ -36,6 +36,7 @@ const Thumb = React.forwardRef<
"dark:bg-neutral-500 hover:dark:bg-neutral-400/80 active:dark:bg-neutral-400",
"before:absolute before:-left-1/2 before:-top-1/2 before:h-full before:min-h-[44]",
"before:w-full before:min-w-[44] before:-translate-x-full before:-translate-y-full before:content-[\"\"]",
className,
)}
/>
@@ -56,6 +57,7 @@ export const Scrollbar = React.forwardRef<
orientation === "horizontal" ?
`h-2.5 w-full flex-col` :
`w-2.5 flex-row`,
"animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in",
className,
)}
>
@@ -84,7 +86,7 @@ export const Viewport = React.forwardRef<
if (!$el) return
if (!$child) return
const handler = () => {
setShouldAddMask($el.scrollHeight > ($el.clientHeight + 48 * 2))
setShouldAddMask($el.scrollHeight > $el.clientHeight + 48 * 2)
}
const observer = new ResizeObserver(handler)
handler()