Skip to content
Source
Sign inSign up
fuko/trytanstackdb.com
Open History to see the last commit

scroll-shadow.tsx

24 lines675 Bytes

1import { cn } from "@/lib/utils";
2​
3export function ScrollShadow({
4 position,
5 visible,
6 fromColor = "from-background",
7}: {
8 position: "top" | "bottom";
9 visible: boolean;
10 /** Tailwind `from-*` class for the gradient start color. Defaults to "from-background". */
11 fromColor?: string;
12}) {
13 return (
14 <div
15 className={cn(
16 "absolute left-0 right-0 h-16 pointer-events-none z-10 transition-opacity duration-300 ease-in-out",
17 position === "top"
18 ? `top-0 bg-linear-to-b ${fromColor} to-transparent`
19 : `bottom-0 bg-linear-to-t ${fromColor} to-transparent`,
20 visible ? "opacity-100" : "opacity-0",
21 )}
22 />
23 );