slider component updated

This commit is contained in:
nabijonovdavronbek619@gmail.com
2026-04-28 11:29:06 +05:00
parent cfa84d04ab
commit 77c6baaa55
25 changed files with 1308 additions and 1770 deletions

View File

@@ -1,11 +1,8 @@
"use client";
import { FaLocationDot } from "react-icons/fa6";
import Text from "../lib_components/text";
import { useTranslation } from "react-i18next";
export default function Header() {
const { t } = useTranslation();
return (
<div
dir="ltr"

View File

@@ -2,26 +2,25 @@
"use client";
import { useEffect, useState } from "react";
import i18n from "@/i18n";
import { animateScroll as scroll } from "react-scroll";
import Text from "../lib_components/text";
import "./navbar.css";
import { logoImg } from "@/assets";
import Image from "next/image";
import { usePathname, useRouter } from "next/navigation";
import { X } from "lucide-react"; // ❗ exit icon
import { X } from "lucide-react";
import { useLocale } from "next-intl";
import { useRouter, usePathname } from "@/i18n/navigation";
export default function Navbar() {
const router = useRouter();
const pathname = usePathname();
const locale = useLocale();
const [toggle, setToggle] = useState(false);
const [togglerIcon, setTogglerIcon] = useState("toggler");
const [lang, setLang] = useState<"uz" | "ru">("uz");
const handleChangeLang = (lng: "uz" | "ru") => {
setLang(lng);
i18n.changeLanguage(lng);
router.replace(pathname, { locale: lng });
};
const changeToggler = () => {
@@ -32,26 +31,23 @@ export default function Navbar() {
};
const scrollOrRoute = (id: string) => {
if (pathname !== `/${lang}`) {
// Agar user boshqa sahifada bo'lsa asosiy sahifaga yo'naltirish
router.push(`/${lang}#${id}`);
if (pathname !== "/") {
router.push(`/#${id}`);
} else {
// Agar main page-da bo'lsa scroll qilish
scroll.scrollTo(document.getElementById(id)!.offsetTop - 100);
}
changeToggler();
};
const goHome = () => {
router.push(`/${lang}`);
router.push("/");
};
// ❗ Scrollni bloklash uchun effect
useEffect(() => {
if (toggle) {
document.body.style.overflow = "hidden"; // orqa scrollni ochir
document.body.style.overflow = "hidden";
} else {
document.body.style.overflow = "auto"; // qayta yoq
document.body.style.overflow = "auto";
}
}, [toggle]);
@@ -69,9 +65,9 @@ export default function Navbar() {
<button
onClick={() => handleChangeLang("uz")}
className={`hover:cursor-pointer ${
lang === "uz" && "bg-secondary text-primary rounded-[8px]"
locale === "uz" && "bg-secondary text-primary rounded-[8px]"
} px-2 py-1 text-[20px] ${
lang !== "uz" && "border-l-2 border-b-2 border-primary"
locale !== "uz" && "border-l-2 border-b-2 border-primary"
} `}
>
UZ
@@ -79,9 +75,9 @@ export default function Navbar() {
<button
onClick={() => handleChangeLang("ru")}
className={`hover:cursor-pointer ${
lang === "ru" && "bg-secondary text-primary rounded-[8px]"
locale === "ru" && "bg-secondary text-primary rounded-[8px]"
} px-2 py-1 text-[20px] ${
lang !== "ru" && "border-r-2 border-b-2 border-primary"
locale !== "ru" && "border-r-2 border-b-2 border-primary"
}`}
>
RU