From 86f3045ccef833f7ffc9c1288d0a3c2939f02cd0 Mon Sep 17 00:00:00 2001 From: moaz_dw Date: Sat, 13 Jul 2024 16:26:20 +0300 Subject: [PATCH] fixes --- src/Components/Home/Categories.tsx | 15 +++++++++ src/Components/Home/CategoriesSlider.tsx | 10 ++++-- src/Components/Home/ProductCard.tsx | 11 +------ src/Components/Home/ProductSwiper.tsx | 31 ++++++++----------- src/Pages/Home/Page.tsx | 3 +- src/Pages/Product/Page.tsx | 12 ++++---- src/Styles/Page/Categories.scss | 16 +++++++++- src/Styles/Page/Home.scss | 39 ++++++++++++++++++------ src/Styles/Page/Product.scss | 5 +-- src/Styles/components/ProductCard.scss | 7 +++++ src/Styles/components/ProductSwiper.scss | 2 +- src/api/Product.ts | 10 ++++++ src/translate/ar.json | 2 +- src/translate/ch.json | 2 +- src/ui/CustomImage.tsx | 21 ++++++------- 15 files changed, 120 insertions(+), 66 deletions(-) create mode 100644 src/Components/Home/Categories.tsx diff --git a/src/Components/Home/Categories.tsx b/src/Components/Home/Categories.tsx new file mode 100644 index 0000000..7a028b4 --- /dev/null +++ b/src/Components/Home/Categories.tsx @@ -0,0 +1,15 @@ +import HomeSlider from "../../Components/Home/CategoriesSlider"; +import { useTranslation } from 'react-i18next'; + +const Categories = () => { + const {t} = useTranslation(); + return ( +
+

{t("What do you like")}?

+ + +
+ ) +} + +export default Categories \ No newline at end of file diff --git a/src/Components/Home/CategoriesSlider.tsx b/src/Components/Home/CategoriesSlider.tsx index 3e4dbb8..0b1c04d 100644 --- a/src/Components/Home/CategoriesSlider.tsx +++ b/src/Components/Home/CategoriesSlider.tsx @@ -12,15 +12,18 @@ import { useGetCategories } from "../../api/Categories"; import { Category } from "../../types/item"; import { useNavigate } from "react-router-dom"; import { addBaseUrlToSrc } from "../../utils/addBaseUrlToSrc"; +import { languageObject } from "../../utils/languageObject"; +import Loading from "../Utils/Loading/Loading"; const CategoriesSlider = () => { - const { data } = useGetCategories(); + const { data , isLoading} = useGetCategories(); const categories = (data?.categories as Category[]) || ([] as []); const navigate = useNavigate(); const handelNavigate = (data: Category) => { navigate(`/categories?category=${data?.id}`); }; - + console.log(categories); + return (
@@ -47,7 +50,7 @@ const CategoriesSlider = () => { }, }} > - {categories?.map((item: Category, index: number) => { + {isLoading ? :categories?.map((item: Category, index: number) => { return (
@@ -56,6 +59,7 @@ const CategoriesSlider = () => { src={addBaseUrlToSrc(item?.photo)} alt={`category ${index + 1}`} /> +

{languageObject(item?.name)}

); diff --git a/src/Components/Home/ProductCard.tsx b/src/Components/Home/ProductCard.tsx index 4d1c39d..371956c 100644 --- a/src/Components/Home/ProductCard.tsx +++ b/src/Components/Home/ProductCard.tsx @@ -78,16 +78,7 @@ const ProductCard = ({ item }: { item: Product }) => {
handle_click(item?.base_product_id)} />

{languageObject(item?.name)}

-
Description: {result}
- - {/*

{Currency} {oldPrice}

-
-

{price}

-

- {randomRate} -

-
*/} - {/* {discountAmount}% */} +
{t("Description")}: {result}