Updated some client pages to externalize the Navbar and Footer

This commit is contained in:
Tiago Ribeiro
2024-03-21 12:47:03 +00:00
parent 78bdb1b275
commit 1c5f16d42b
6 changed files with 95 additions and 71 deletions

View File

@@ -1,9 +1,17 @@
import {getData} from "@/cms"; import {getData} from "@/cms";
import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar";
import ContactUs from "@/templates/ContactUs"; import ContactUs from "@/templates/ContactUs";
import ContactPage from "@/types/cms/contact"; import ContactPage from "@/types/cms/contact";
export default async function Page() { export default async function Page() {
const {data} = await getData<ContactPage>("contact", "ar"); const {data} = await getData<ContactPage>("contact", "ar");
return <ContactUs data={data.data.attributes} page="/contact" language="ar" />; return (
<main className="text-mti-black flex h-screen w-full flex-col bg-white" dir="rtl">
<Navbar currentPage="/contact" language="ar" />
<ContactUs data={data.data.attributes} />;
<Footer language="ar" />
</main>
);
} }

View File

@@ -1,9 +1,17 @@
import {getData} from "@/cms"; import {getData} from "@/cms";
import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar";
import Price from "@/templates/Price"; import Price from "@/templates/Price";
import PricePage from "@/types/cms/price"; import PricePage from "@/types/cms/price";
export default async function Page() { export default async function Page() {
const {data} = await getData<PricePage>("price", "ar"); const {data} = await getData<PricePage>("price", "ar");
return <Price data={data.data.attributes} language="ar" />; return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir="rtl">
<Navbar currentPage="/price" language="ar" />
<Price data={data.data.attributes} language="ar" />
<Footer language="ar" />
</main>
);
} }

View File

@@ -1,9 +1,17 @@
import {getData} from "@/cms"; import {getData} from "@/cms";
import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar";
import ContactUs from "@/templates/ContactUs"; import ContactUs from "@/templates/ContactUs";
import ContactPage from "@/types/cms/contact"; import ContactPage from "@/types/cms/contact";
export default async function Page() { export default async function Page() {
const {data} = await getData<ContactPage>("contact", "en"); const {data} = await getData<ContactPage>("contact", "en");
return <ContactUs data={data.data.attributes} page="/contact" language="en" />; return (
<main className="text-mti-black flex h-screen w-full flex-col bg-white" dir="ltr">
<Navbar currentPage="/contact" language="en" />
<ContactUs data={data.data.attributes} />;
<Footer language="en" />
</main>
);
} }

View File

@@ -1,9 +1,17 @@
import {getData} from "@/cms"; import {getData} from "@/cms";
import Footer from "@/components/Footer";
import Navbar from "@/components/Navbar";
import Price from "@/templates/Price"; import Price from "@/templates/Price";
import PricePage from "@/types/cms/price"; import PricePage from "@/types/cms/price";
export default async function Page() { export default async function Page() {
const {data} = await getData<PricePage>("price", "en"); const {data} = await getData<PricePage>("price", "en");
return <Price data={data.data.attributes} language="en" />; return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir="ltr">
<Navbar currentPage="/price" language="en" />
<Price data={data.data.attributes} language="en" />
<Footer language="en" />
</main>
);
} }

View File

@@ -18,9 +18,7 @@ type FormValues = {
}; };
interface Props { interface Props {
language: "en" | "ar";
data: ContactPage; data: ContactPage;
page: string;
} }
const ErrorMessage = ({message}: {message: string}) => ( const ErrorMessage = ({message}: {message: string}) => (
@@ -28,7 +26,7 @@ const ErrorMessage = ({message}: {message: string}) => (
<span className="text-mti-red">{message}</span> <span className="text-mti-red">{message}</span>
</div> </div>
); );
export default function App({language, data, page}: Props) { export default function App({data}: Props) {
const selectOptions = [ const selectOptions = [
{ {
label: data.Feedback, label: data.Feedback,
@@ -92,8 +90,6 @@ export default function App({language, data, page}: Props) {
return ( return (
<> <>
<ToastContainer /> <ToastContainer />
<main className="text-mti-black flex h-screen w-full flex-col bg-white" dir={language === "ar" ? "rtl" : "ltr"}>
<Navbar currentPage={page} language={language} />
<section className="w-full bg-mti-purple text-white text-center p-8 md:p-16"> <section className="w-full bg-mti-purple text-white text-center p-8 md:p-16">
<div className="w-full h-full flex flex-col items-center justify-center"> <div className="w-full h-full flex flex-col items-center justify-center">
<Title>{data.Title}</Title> <Title>{data.Title}</Title>
@@ -151,8 +147,6 @@ export default function App({language, data, page}: Props) {
<Image src="/person_laptop_focus.jpg" alt="Contact Us" width={500} height={340} className="rounded-xl" /> <Image src="/person_laptop_focus.jpg" alt="Contact Us" width={500} height={340} className="rounded-xl" />
</div> </div>
</section> </section>
<Footer language={language} />
</main>
</> </>
); );
} }

View File

@@ -67,8 +67,7 @@ export default function Page({language, data}: Props) {
getData(); getData();
}, []); }, []);
return ( return (
<main className="h-screen w-full bg-white text-mti-black flex flex-col" dir={language === "ar" ? "rtl" : "ltr"}> <>
<Navbar currentPage="/price" language={language} />
<section className="w-full relative bg-white px-8 flex flex-col items-center text-center gap-4"> <section className="w-full relative bg-white px-8 flex flex-col items-center text-center gap-4">
<h2 className="text-3xl font-bold">{data.Title}</h2> <h2 className="text-3xl font-bold">{data.Title}</h2>
<div className="grid grid-cols-2 gap-8"> <div className="grid grid-cols-2 gap-8">
@@ -103,7 +102,6 @@ export default function Page({language, data}: Props) {
{data.SignUp} {data.SignUp}
</Link> </Link>
</section> </section>
<Footer language={language} /> </>
</main>
); );
} }