Files
tm-landing/app/layout.tsx
T
AmirReza Jamali 31d03b57d6 feat: Refactor layout and add toast notifications
This commit introduces a major structural refactoring by creating a shared application layout and integrates a toast notification system.

Key changes:
- A new `layout.tsx` file now contains the common Header and Footer components, ensuring a consistent structure across all pages.
- The main `page.tsx` has been simplified to only contain its specific content, with layout elements removed.
- The `react-toastify` library has been added to provide user feedback through toast notifications.
- Custom CSS styles have been applied to the toast notifications for a branded look and feel, including different gradient backgrounds for success, error, warning, and info states.
- The `.gitignore` file was updated to explicitly track the `.env` file, likely for an example configuration.
2025-10-15 17:12:09 +03:30

184 lines
4.9 KiB
TypeScript

import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import Image from "next/image";
import Link from "next/link";
import { ToastContainer, Zoom } from "react-toastify";
import HeaderButtons from "./_components/HeaderButtons";
import "./globals.css";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
});
const geistMono = Geist_Mono({
variable: "--font-geist-mono",
subsets: ["latin"],
});
export const metadata: Metadata = {
title: "Create Next App",
description: "Generated by create next app",
};
function ContactInfo({
icon,
contact,
href,
ariaLabel,
}: {
icon: string;
contact: string;
href?: string;
ariaLabel: string;
}) {
return (
<div className="flex gap-3 my-3">
<Image
src={icon}
width={24}
height={24}
alt=""
aria-hidden="true"
/>
{href ? (
<a
href={href}
className="cursor-pointer"
aria-label={ariaLabel}>
{contact}
</a>
) : (
<p>{contact}</p>
)}
</div>
);
}
export default async function RootLayout({
children,
}: Readonly<{
children: React.ReactNode;
}>) {
const contactInfo = [
{
icon: "/Message.svg",
contact: "info@opplens.com",
href: "mailto:info@opplens.com",
ariaLabel: "Email us at info@opplens.com",
},
{
icon: "/Phone.svg",
contact: "(+46) - 761581526",
href: "tel:+46761581526",
ariaLabel: "Call us at +46 761581526",
},
{
icon: "/Location.svg",
contact: "Stockholm, Sweden",
ariaLabel: "Our location in Stockholm, Sweden",
},
];
return (
<html lang="en">
<body
className={`${geistSans.variable} ${geistMono.variable} antialiased`}>
<div className="container px-4 py-4 m-auto">
<header className="flex justify-between items-center border-b md:border-none border-gray-300 pb-4">
<Link
href="/"
aria-label="Opp lens home">
<Image
src="/main-logo.svg"
alt="Opp lens logo"
width={180}
height={30}
priority
/>
</Link>
<div className="flex gap-5 items-center">
<nav
className="hidden md:flex"
aria-label="Main navigation">
<HeaderButtons />
</nav>
<label
htmlFor="language"
className="sr-only">
Select language
</label>
<select
name="language"
id="language"
aria-label="Language selector">
<option value="en">English</option>
</select>
</div>
</header>
<nav
className="block md:hidden"
aria-label="Mobile navigation">
<HeaderButtons />
</nav>
<div className="hidden absolute -z-20 left-0 md:block">
<Image
src={"/side-shallow.svg"}
alt="Shallow"
width={235}
height={235}
/>
</div>
<ToastContainer
position="top-right"
autoClose={2500}
theme={"colored"}
transition={Zoom}
hideProgressBar
newestOnTop
closeOnClick
pauseOnFocusLoss
draggable
pauseOnHover
/>
{children}
<div className="hidden absolute -z-20 right-0 rotate-y-180 md:block">
<Image
src={"/side-shallow.svg"}
alt="Shallow"
width={235}
height={235}
/>
</div>
<footer className="mt-14">
<div className="flex justify-center items-center border-t pt-5 border-gray-300">
<Image
src="/main-logo.svg"
alt="Opp lens logo"
width={180}
height={30}
/>
</div>
<address className="md:flex md:justify-evenly w-full mt-14 px-5 not-italic">
{contactInfo.map((item) => (
<ContactInfo
key={item.contact}
contact={item.contact}
href={item.href}
icon={item.icon}
ariaLabel={item.ariaLabel}
/>
))}
</address>
<div className="flex justify-center items-center">
<p className="text-center text-(--gray-primary) mt-5 leading-10">
Stockholm, Sweden © 2025 Opplens.com by PBL Partners AB. All
Rights Reserved. Democratizing Tender Access for SMEs.
</p>
</div>
</footer>
</div>
</body>
</html>
);
}