项目文件夹

文件
wehub-resource-sync 2114b14ee0
Sync main into demo / sync (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:35:26 +08:00

33 行
705 B
TypeScript

interface TimelineTopBarVisibilityParams {
currentTop: number;
previousTop: number;
isVisible: boolean;
threshold?: number;
}
interface ProfileTopBarVisibilityParams {
scrollTop: number;
threshold: number;
}
export function getNextTimelineTopBarVisibility({
currentTop,
previousTop,
isVisible,
threshold = 6,
}: TimelineTopBarVisibilityParams): boolean {
if (currentTop <= 0) return true;
const delta = currentTop - previousTop;
if (delta > threshold) return false;
if (delta < -threshold) return true;
return isVisible;
}
export function shouldShowProfileTopBar({
scrollTop,
threshold,
}: ProfileTopBarVisibilityParams): boolean {
return scrollTop >= threshold;
}