Initial commit

This commit is contained in:
DK
2025-12-23 16:54:16 +00:00
commit 7451448e29
307 changed files with 62614 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
import { useLenis } from "lenis/react";
export const useButtonClick = (href?: string, onClick?: () => void) => {
const lenis = useLenis();
const handleClick = () => {
if (href) {
const isExternalLink = /^(https?:\/\/|www\.)/.test(href);
if (isExternalLink) {
window.open(
href.startsWith("www.") ? `https://${href}` : href,
"_blank",
"noopener,noreferrer"
);
} else {
if (lenis) {
lenis.scrollTo(`#${href}`);
} else {
const element = document.getElementById(href);
if (element) {
element.scrollIntoView({ behavior: "smooth" });
}
}
}
}
onClick?.();
};
return handleClick;
};