feat(settings): 站点界面动画总开关与子开关
管理后台可关全站动画,并细调代码折叠、平滑滚动、装饰入场;统一 lib/motion,尊重系统减少动态效果。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
} from "react";
|
||||
import { Check, Copy, ChevronDown, ChevronUp } from "lucide-react";
|
||||
import { toast } from "@/lib/toast";
|
||||
import { allowMotion } from "@/lib/motion";
|
||||
import { useCodeFoldConfig } from "./CodeFoldProvider";
|
||||
|
||||
const FOLD_ANIM_MS = 360;
|
||||
@@ -34,10 +35,7 @@ function measureCollapsedPx(host: HTMLElement, foldLines: number): number {
|
||||
}
|
||||
|
||||
function prefersReducedMotion(): boolean {
|
||||
return (
|
||||
typeof window !== "undefined" &&
|
||||
window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||
);
|
||||
return !allowMotion("codeFold");
|
||||
}
|
||||
|
||||
type MdCodeBlockProps = HTMLAttributes<HTMLPreElement> & {
|
||||
|
||||
Reference in New Issue
Block a user