refactor: Migrate documentation content, rebuild UI components, and update core architecture.

This commit is contained in:
gitfromwildan
2026-03-10 01:38:58 +07:00
parent aac81dff8a
commit ab755844a3
132 changed files with 3947 additions and 12862 deletions

View File

@@ -1,29 +1,31 @@
import { useState, useCallback, useEffect } from 'react';
"use client"
import { useState, useCallback, useEffect } from "react"
export function useScrollPosition(threshold = 0.5) {
const [isScrolled, setIsScrolled] = useState(false);
const [isScrolled, setIsScrolled] = useState(false)
const handleScroll = useCallback(() => {
if (typeof window === 'undefined') return;
if (typeof window === "undefined") return
const scrollPosition = window.scrollY;
const viewportHeight = window.innerHeight;
const shouldBeSticky = scrollPosition > viewportHeight * threshold;
const scrollPosition = window.scrollY
const viewportHeight = window.innerHeight
const shouldBeSticky = scrollPosition > viewportHeight * threshold
setIsScrolled(prev => shouldBeSticky !== prev ? shouldBeSticky : prev);
}, [threshold]);
setIsScrolled((prev) => (shouldBeSticky !== prev ? shouldBeSticky : prev))
}, [threshold])
// Add scroll event listener
useEffect(() => {
// Initial check
// eslint-disable-next-line react-hooks/set-state-in-effect
handleScroll();
handleScroll()
window.addEventListener('scroll', handleScroll, { passive: true });
window.addEventListener("scroll", handleScroll, { passive: true })
return () => {
window.removeEventListener('scroll', handleScroll);
};
}, [handleScroll]);
window.removeEventListener("scroll", handleScroll)
}
}, [handleScroll])
return isScrolled;
return isScrolled
}