1"use client"
2
3import { motion, useScroll, type MotionProps } from "motion/react"
4
5import { cn } from "@/lib/utils"
6
7interface ScrollProgressProps extends Omit<
8 React.HTMLAttributes<HTMLElement>,
9 keyof MotionProps
10> {
11 ref?: React.Ref<HTMLDivElement>
12}
13
14export function ScrollProgress({
15 className,
16 ref,
17 ...props
18}: ScrollProgressProps) {
19 const { scrollYProgress } = useScroll()
20
21 return (
22 <motion.div
23 ref={ref}
24 className={cn(
25 "fixed inset-x-0 top-0 z-50 h-px origin-left bg-linear-to-r from-[#A97CF8] via-[#F38CB8] to-[#FDCC92]",
26 className
27 )}
28 style={{
29 scaleX: scrollYProgress,
30 }}
31 {...props}
32 />
33 )
34}
35