95 lines
3.3 KiB
TypeScript
95 lines
3.3 KiB
TypeScript
'use client';
|
|
|
|
import { motion } from "framer-motion";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Heart } from "lucide-react";
|
|
import { ThemeToggle } from "@/components/ThemeToggle";
|
|
import { useEffect, useState } from "react";
|
|
|
|
export function Navbar() {
|
|
const [isDark, setIsDark] = useState(false);
|
|
|
|
useEffect(() => {
|
|
const checkTheme = () => {
|
|
setIsDark(document.documentElement.classList.contains('dark'));
|
|
};
|
|
|
|
checkTheme();
|
|
const observer = new MutationObserver(checkTheme);
|
|
observer.observe(document.documentElement, {
|
|
attributes: true,
|
|
attributeFilter: ['class']
|
|
});
|
|
|
|
return () => observer.disconnect();
|
|
}, []);
|
|
|
|
const scrollToSection = (id: string) => {
|
|
const element = document.getElementById(id);
|
|
if (element) {
|
|
element.scrollIntoView({ behavior: "smooth" });
|
|
}
|
|
};
|
|
|
|
return (
|
|
<motion.nav
|
|
initial={{ y: -100 }}
|
|
animate={{ y: 0 }}
|
|
transition={{ duration: 0.5 }}
|
|
className="fixed top-0 left-0 right-0 z-50 border-b border-border/50"
|
|
style={{
|
|
backgroundColor: isDark ? '#1a1e26' : '#ffffff'
|
|
}}
|
|
>
|
|
<div className="container mx-auto px-4">
|
|
<div className="flex items-center justify-between h-16">
|
|
<motion.a
|
|
href="#home"
|
|
className="flex items-center gap-2"
|
|
whileHover={{ scale: 1.05 }}
|
|
whileTap={{ scale: 0.95 }}
|
|
>
|
|
<div className="bg-gradient-to-br from-rose-500 to-pink-600 p-2 rounded-xl">
|
|
<Heart className="h-5 w-5 text-white fill-white" />
|
|
</div>
|
|
<span className="font-bold text-lg bg-gradient-to-r from-rose-600 via-pink-600 to-orange-600 bg-clip-text text-transparent">
|
|
Attune Heart Therapy
|
|
</span>
|
|
</motion.a>
|
|
|
|
<div className="hidden md:flex items-center gap-6">
|
|
<button
|
|
onClick={() => scrollToSection("about")}
|
|
className="text-sm font-medium hover:text-primary transition-colors cursor-pointer px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-cyan-900/30"
|
|
>
|
|
About
|
|
</button>
|
|
<button
|
|
onClick={() => scrollToSection("services")}
|
|
className="text-sm font-medium hover:text-primary transition-colors cursor-pointer px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-cyan-900/30"
|
|
>
|
|
Services
|
|
</button>
|
|
<button
|
|
onClick={() => scrollToSection("contact")}
|
|
className="text-sm font-medium hover:text-primary transition-colors cursor-pointer px-3 py-2 rounded-lg hover:bg-gray-100 dark:hover:bg-cyan-900/30"
|
|
>
|
|
Contact
|
|
</button>
|
|
</div>
|
|
|
|
<div className="flex items-center gap-2">
|
|
<Button size="sm" variant="outline" className="hidden sm:inline-flex hover:opacity-90 hover:scale-105 transition-all dark:hover:bg-cyan-900/30" asChild>
|
|
<a href="/login">Sign In</a>
|
|
</Button>
|
|
<ThemeToggle />
|
|
<Button size="sm" className="hidden sm:inline-flex hover:opacity-90 hover:scale-105 transition-all dark:hover:bg-emerald-600" asChild>
|
|
<a href="tel:+19548073027">Book Now</a>
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</motion.nav>
|
|
);
|
|
}
|