handle active list header links
This commit is contained in:
@@ -3,7 +3,7 @@ import Layout from "@/components/layout/StLayout";
|
|||||||
|
|
||||||
function AboutUs() {
|
function AboutUs() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout name='/about-us'>
|
||||||
<AboutUsPage />
|
<AboutUsPage />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ import Layout from "@/components/layout/StLayout";
|
|||||||
|
|
||||||
function Blogs() {
|
function Blogs() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout name='/blogs'>
|
||||||
<BlogsPage />
|
<BlogsPage />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ import Layout from "@/components/layout/StLayout";
|
|||||||
|
|
||||||
function Clinics() {
|
function Clinics() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout name='/clinics'>
|
||||||
<ClinicsPage />
|
<ClinicsPage />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import Layout from "@/components/layout/StLayout";
|
|||||||
|
|
||||||
function ContactUs() {
|
function ContactUs() {
|
||||||
return (
|
return (
|
||||||
<Layout title="تماس با ما" name="contact-us">
|
<Layout name="/contact-us">
|
||||||
<ContactUsPage />
|
<ContactUsPage />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ import Layout from "@/components/layout/StLayout";
|
|||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
return (
|
return (
|
||||||
<Layout>
|
<Layout name='/'>
|
||||||
<HomePage />
|
<HomePage />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import SpecialtiesPage from "@/components/specialties";
|
|||||||
|
|
||||||
function Specialties() {
|
function Specialties() {
|
||||||
return (
|
return (
|
||||||
<Layout title="تخصص ها" name="specialties">
|
<Layout name="/specialties">
|
||||||
<SpecialtiesPage />
|
<SpecialtiesPage />
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { getStateInfo } from "@/lib/getStateInfo";
|
|||||||
import Footer from "./footer";
|
import Footer from "./footer";
|
||||||
import Header from "./header";
|
import Header from "./header";
|
||||||
|
|
||||||
function StLayout({ children }) {
|
function StLayout({ children, name }) {
|
||||||
const { matchedCity } = getStateInfo();
|
const { matchedCity } = getStateInfo();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -10,7 +10,7 @@ function StLayout({ children }) {
|
|||||||
<main className="w-full min-h-screen">
|
<main className="w-full min-h-screen">
|
||||||
<header className="w-full sticky bg-[#FFF] !z-[70] shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)] mt-[12px] sm:mt-[21px] md:mt-[30px] lg:mt-[40px] top-0 right-1/2">
|
<header className="w-full sticky bg-[#FFF] !z-[70] shadow-[0px_1px_24.8px_0px_rgba(204,_204,_204,_0.18)] mt-[12px] sm:mt-[21px] md:mt-[30px] lg:mt-[40px] top-0 right-1/2">
|
||||||
<div className="w-full padding-responsive">
|
<div className="w-full padding-responsive">
|
||||||
<Header matchedCity={matchedCity} />
|
<Header matchedCity={matchedCity} name={name} />
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<section
|
<section
|
||||||
|
|||||||
@@ -10,13 +10,12 @@ function Row({ name }) {
|
|||||||
<Link
|
<Link
|
||||||
href={nav.link}
|
href={nav.link}
|
||||||
className={`
|
className={`
|
||||||
${
|
${nav.link === name
|
||||||
isActiveURL(nav.link.replace("/", ""), name)
|
? "!text-[#526CAC]"
|
||||||
? "!text-[#526CAC]"
|
: "text-[#525252]"
|
||||||
: "text-[#525252]"
|
}
|
||||||
}
|
text-[16px] font-medium
|
||||||
text-[16px] font-medium
|
`}
|
||||||
`}
|
|
||||||
>
|
>
|
||||||
{nav.name}
|
{nav.name}
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
+1
-4
@@ -6,15 +6,12 @@ export const numberToArStyle = (num) => num.toLocaleString("ar-AE");
|
|||||||
export const isActiveURL = (link, name) => link === name;
|
export const isActiveURL = (link, name) => link === name;
|
||||||
|
|
||||||
export const convertToJalali = (date) => {
|
export const convertToJalali = (date) => {
|
||||||
// Get the current Gregorian date
|
|
||||||
const currentDate = date;
|
const currentDate = date;
|
||||||
|
|
||||||
// Convert the Gregorian date to Jalali date
|
|
||||||
const jalaliDate = moment(currentDate).format("jYYYY/jM/jD");
|
const jalaliDate = moment(currentDate).format("jYYYY/jM/jD");
|
||||||
|
|
||||||
// Get Jalali year, month, and day
|
|
||||||
const jalaliYear = moment(jalaliDate, "jYYYY/jM/jD").jYear();
|
const jalaliYear = moment(jalaliDate, "jYYYY/jM/jD").jYear();
|
||||||
const jalaliMonth = moment(jalaliDate, "jYYYY/jM/jD").jMonth() + 1; // Note: jalali-moment months are zero-based
|
const jalaliMonth = moment(jalaliDate, "jYYYY/jM/jD").jMonth() + 1;
|
||||||
const jalaliDay = moment(jalaliDate, "jYYYY/jM/jD").jDate();
|
const jalaliDay = moment(jalaliDate, "jYYYY/jM/jD").jDate();
|
||||||
|
|
||||||
return `${jalaliYear}/${jalaliMonth}/${jalaliDay}`;
|
return `${jalaliYear}/${jalaliMonth}/${jalaliDay}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user