first project version mrDecor

This commit is contained in:
alirez.br
2026-05-11 15:30:57 +03:30
commit 8724072983
302 changed files with 25401 additions and 0 deletions
@@ -0,0 +1,24 @@
import { cn } from "@/lib/utils";
interface MeteorTitleBackgroundProps {
className?: string;
count?: number;
}
const meteorIndices = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16];
export function MeteorTitleBackground({ className, count = 16 }: MeteorTitleBackgroundProps) {
return (
<div
aria-hidden
className={cn(
"pointer-events-none absolute inset-0 overflow-hidden rounded-2xl",
className,
)}
>
{meteorIndices.slice(0, count).map((index) => (
<span key={index} className={cn("meteor-title-streak", `meteor-title-streak-${index}`)} />
))}
</div>
);
}
+53
View File
@@ -0,0 +1,53 @@
"use client";
import { useEffect, useState } from "react";
import { ChevronUp } from "lucide-react";
import { Button } from "@/components/ui/button";
import { cn } from "@/lib/utils";
const SCROLL_THRESHOLD = 0.4; // show after 40% scroll
export function ScrollToTop({ className }: { className?: string }) {
const [visible, setVisible] = useState(false);
useEffect(() => {
function onScroll() {
const maxScroll =
document.documentElement.scrollHeight - window.innerHeight;
if (maxScroll <= 0) {
setVisible(false);
return;
}
const ratio = window.scrollY / maxScroll;
setVisible(ratio >= SCROLL_THRESHOLD);
}
onScroll();
window.addEventListener("scroll", onScroll, { passive: true });
return () => window.removeEventListener("scroll", onScroll);
}, []);
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: "smooth" });
};
if (!visible) return null;
return (
<div
className={cn(
"fixed bottom-6 start-6 z-50 transition-opacity duration-300",
className
)}
>
<Button
size="icon-lg"
variant="outline"
onClick={scrollToTop}
aria-label="برگشت به بالا"
>
<ChevronUp className="size-5" />
</Button>
</div>
);
}