feat: implement internationalization and routing for locale-based pages
- Added RootLayout component to handle locale and message loading. - Created Home page with header, about info, products, and story sections. - Developed ProductPage for displaying product categories and products. - Implemented ProductsPage to list product categories with banners. - Added Projects page with a grid layout for project display. - Configured server settings for port and host. - Established navigation and routing for internationalization. - Set up request handling for locale and message retrieval. - Defined routing structure for supported locales. - Created middleware for locale-based routing. - Defined layout parameters for locale handling.
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
'use client';
|
||||
|
||||
import images from '@/assets/images/images';
|
||||
import SectionTitle from '@/components/layout/sectionTitle';
|
||||
import { t } from '@/locales/translates';
|
||||
import Image from 'next/image';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
export default function HomeStorySection({
|
||||
className = '',
|
||||
}: {
|
||||
className?: string;
|
||||
}) {
|
||||
const t = useTranslations();
|
||||
|
||||
const statisticsData = [
|
||||
{
|
||||
title: t('com_home_story_projects_count') as string,
|
||||
title: t('com_home_story_projects_count'),
|
||||
count: '10K',
|
||||
},
|
||||
{
|
||||
title: t('com_home_story_customer_count') as string,
|
||||
title: t('com_home_story_customer_count'),
|
||||
count: '500',
|
||||
},
|
||||
{
|
||||
title: t('com_home_story_experience') as string,
|
||||
title: t('com_home_story_experience'),
|
||||
count: '25',
|
||||
},
|
||||
];
|
||||
@@ -27,9 +31,9 @@ export default function HomeStorySection({
|
||||
<div className={`container mx-auto flex flex-col gap-12 ${className}`}>
|
||||
<div className="grid grid-cols-2 gap-10">
|
||||
<SectionTitle
|
||||
title={t('com_home_story_title') as string}
|
||||
description={t('com_home_story_slogan') as string}
|
||||
description_bold={t('com_home_story_slogan_bold') as string}
|
||||
title={t('com_home_story_title')}
|
||||
description={t('com_home_story_slogan')}
|
||||
description_bold={t('com_home_story_slogan_bold')}
|
||||
/>
|
||||
<div className="grid grid-cols-2 gap-3">
|
||||
{[images.homeBanner, images.aboutImg_1].map((e, i) => (
|
||||
@@ -53,7 +57,7 @@ export default function HomeStorySection({
|
||||
</div>
|
||||
<div className="flex flex-col py-8">
|
||||
<p className="text-base font-light text-gray-500">
|
||||
{t('com_home_story_description') as string}
|
||||
{t('com_home_story_description')}
|
||||
</p>
|
||||
<hr className="my-10 text-gray-100/50" />
|
||||
<div className="grid grid-cols-3 justify-between gap-1">
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
import images from '@/assets/images/images';
|
||||
import SectionTitle from '@/components/layout/sectionTitle';
|
||||
import { t } from '@/locales/translates';
|
||||
import type { IProductCategoryCardProps } from '../productCategories/productCategoryCard.d';
|
||||
import { getProductCategories } from '@/services/products';
|
||||
import Link from 'next/link';
|
||||
import routeFactory from '@/assets/constants/routeFactory';
|
||||
import { getTranslations } from 'next-intl/server';
|
||||
import { ILayoutLocaleParams } from '@/models/layout';
|
||||
import { TLocales } from '@/locales/translates';
|
||||
|
||||
export default async function HomePageProducts() {
|
||||
interface Props {
|
||||
locale: TLocales;
|
||||
}
|
||||
|
||||
export default async function HomePageProducts({ locale }: Props) {
|
||||
const t = await getTranslations({ locale });
|
||||
const productCategories: IProductCategoryCardProps[] =
|
||||
await getProductCategories();
|
||||
const routes = routeFactory(t, locale);
|
||||
|
||||
return (
|
||||
<div className="w-full">
|
||||
@@ -19,12 +27,12 @@ export default async function HomePageProducts() {
|
||||
<div className="absolute inset-0 z-10 bg-black opacity-50" />
|
||||
<div className="relative z-20 container mx-auto grid grid-cols-2 gap-28">
|
||||
<SectionTitle
|
||||
title={t('pages_product_categories_title') as string}
|
||||
description={t('com_home_products_title') as string}
|
||||
title={t('pages_product_categories_title')}
|
||||
description={t('com_home_products_title')}
|
||||
reverseColor
|
||||
/>
|
||||
<h4 className="pt-10 text-base font-extralight tracking-normal text-white">
|
||||
{t('com_home_products_description') as string}
|
||||
{t('com_home_products_description')}
|
||||
</h4>
|
||||
</div>
|
||||
</div>
|
||||
@@ -32,16 +40,17 @@ export default async function HomePageProducts() {
|
||||
<div className="relative top-[-100px] z-20 container mx-auto w-full">
|
||||
<div className="grid grid-cols-1 gap-8 rounded-4xl bg-gray-50 py-10 shadow-2xl md:grid-cols-2 lg:grid-cols-4">
|
||||
{productCategories.map((category, index) => (
|
||||
<Link href={routeFactory.products.route(category.id)}>
|
||||
<Link key={category.id} href={routes.products.route(category.id)}>
|
||||
<div
|
||||
key={index}
|
||||
className={`flex flex-col items-center justify-center gap-4 p-6 text-center ${index ? 'border-s-[1px] border-gray-100' : ''}`}
|
||||
>
|
||||
<h3 className="text-xl font-bold text-gray-500">
|
||||
{category.title}
|
||||
</h3>
|
||||
<p className="text-lg font-light text-gray-400">
|
||||
{`Includes ${category.typesCount} Products`}
|
||||
{t('com_products_category_types_count', {
|
||||
count: category.typesCount,
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
</Link>
|
||||
|
||||
Reference in New Issue
Block a user