detail page updated , product name zustand clear
This commit is contained in:
@@ -7,6 +7,7 @@ import { motion } from "framer-motion";
|
||||
import LanguageSwitcher from "./languageSwitcher";
|
||||
import { useLanguage } from "@/context/language-context";
|
||||
import Image from "next/image";
|
||||
import { useProductStore } from "@/lib/productZustand";
|
||||
|
||||
interface NavLink {
|
||||
id: string;
|
||||
@@ -21,12 +22,13 @@ interface NavbarProps {
|
||||
export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
const { t } = useLanguage();
|
||||
const resetProductName = useProductStore((state) => state.resetProductName);
|
||||
|
||||
const navLinks: NavLink[] = [
|
||||
{ id: "about", labelKey: t.nav.about, href: "#about" },
|
||||
{ id: "products", labelKey: t.nav.products, href: "#products" },
|
||||
{ id: "faq", labelKey: t.nav.faq, href: "#faq" },
|
||||
{ id: "contact", labelKey: t.nav.contact , href: "#contact" },
|
||||
{ id: "contact", labelKey: t.nav.contact, href: "#contact" },
|
||||
];
|
||||
|
||||
const handleScroll = (href: string) => {
|
||||
@@ -47,9 +49,16 @@ export function Navbar({ logoText = "FIRMA" }: NavbarProps) {
|
||||
<motion.div whileHover={{ scale: 1.05 }} whileTap={{ scale: 0.95 }}>
|
||||
<Link
|
||||
href={`/`}
|
||||
onClick={() => resetProductName()}
|
||||
className=" relative overflow-hidden"
|
||||
>
|
||||
<Image src='/logo.jpg' alt="image" width={80} height={50} className="rounded-xl object-cover" />
|
||||
<Image
|
||||
src="/logo.jpg"
|
||||
alt="image"
|
||||
width={80}
|
||||
height={50}
|
||||
className="rounded-xl object-cover"
|
||||
/>
|
||||
</Link>
|
||||
</motion.div>
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { motion } from "framer-motion";
|
||||
import { X } from "lucide-react";
|
||||
import type { Product } from "@/lib/products";
|
||||
import { useLanguage } from "@/context/language-context";
|
||||
import Link from "next/link";
|
||||
import { useProduct, useProductStore } from "@/lib/productZustand";
|
||||
@@ -14,6 +12,13 @@ export default function DetailInfo() {
|
||||
const product = useProduct((state) => state.product);
|
||||
if (product === null) return null;
|
||||
|
||||
const handleScroll = (href: string) => {
|
||||
const element = document.querySelector(href);
|
||||
if (element) {
|
||||
element.scrollIntoView({ behavior: "smooth" });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="bg-white">
|
||||
<div className="max-w-[1200px] mx-auto">
|
||||
@@ -46,7 +51,10 @@ export default function DetailInfo() {
|
||||
</div>
|
||||
{/* CTA Buttons */}
|
||||
<div className="space-y-3">
|
||||
<Link href={"#contact"}>
|
||||
<Link
|
||||
href={"#contact"}
|
||||
onClick={() => handleScroll("#contact")}
|
||||
>
|
||||
<motion.button
|
||||
whileHover={{ scale: 1.05 }}
|
||||
whileTap={{ scale: 0.95 }}
|
||||
|
||||
@@ -20,7 +20,7 @@ export default function LanguageSwitcher() {
|
||||
<div>
|
||||
<DropdownMenu>
|
||||
<DropdownMenuTrigger asChild>
|
||||
<button className="flex items-center gap-1 p-1 border-white border text-black hover:text-primary transition-colors">
|
||||
<button className="flex items-center gap-1 p-1 border-white border text-primary hover:cursor-pointer transition-colors">
|
||||
<Globe size={16} />
|
||||
{language.toUpperCase()}
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user