feat: add certificate gallery and certifications section components

- Implemented CertificateGallery component to display certification images in a gallery format.
- Created CertificationsSection component to showcase certifications with titles and descriptions.
- Enhanced Gallery component to support animations and keyboard navigation.
- Introduced Select component for dropdown selection with images.
- Added utility functions for API responses and pagination handling.
- Implemented localization functions for text and content.
- Created a custom hook for detecting clicks outside of a component.
This commit is contained in:
2026-07-19 07:59:16 +03:30
parent 478b550c51
commit 730e2d8ca8
60 changed files with 1859 additions and 1403 deletions
+14 -38
View File
@@ -2,57 +2,33 @@
import type { IProductCategoryCardProps } from '@/components/pages/productCategories/productCategoryCard.d';
import type { IProductCardProps } from '@/components/pages/products/productCard/productCard.d';
import api from '@/lib/axios';
import { serverGet } from '@/lib/server-api';
import { IResponse } from '@/models/response';
import { cookies } from 'next/headers';
export async function getProductCategories() {
const cookiesStore = await cookies();
return api
.get('/product_categories', {
headers: {
Cookie: cookiesStore.toString(),
},
})
.then(({ data }) => {
return Promise.resolve(data.data);
})
.catch((error) => Promise.reject(error));
const data = await serverGet<{ data: IProductCategoryCardProps[] }>(
'/product_categories',
);
return data.data;
}
export async function getProductCategoryById(
categoryId: string,
): Promise<IProductCategoryCardProps> {
const cookiesStore = await cookies();
return api
.get(`/product_categories/${categoryId}`, {
headers: {
Cookie: cookiesStore.toString(),
},
})
.then(({ data }) => {
return Promise.resolve(data.data);
})
.catch((error) => Promise.reject(error));
const data = await serverGet<{ data: IProductCategoryCardProps }>(
`/product_categories/${categoryId}`,
);
return data.data;
}
export async function getProducts(
categoryId: string,
page = 1,
): Promise<IResponse<IProductCardProps[]>> {
const cookiesStore = await cookies();
console.log('request');
console.log(page);
return api
.get(`/product_categories/${categoryId}/products`, {
headers: {
Cookie: cookiesStore.toString(),
},
return serverGet<IResponse<IProductCardProps[]>>(
`/product_categories/${categoryId}/products`,
{
params: { page },
})
.then(({ data }) => {
return Promise.resolve(data);
})
.catch((error) => Promise.reject(error));
},
);
}