From f99e0aba70efad0deb907d8e27f09fc9f527c8a4 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Fri, 17 Feb 2023 17:07:50 +0700 Subject: Refactor --- src/lib/brand/components/Brand.jsx | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/lib/brand/components/Brand.jsx (limited to 'src/lib/brand/components/Brand.jsx') diff --git a/src/lib/brand/components/Brand.jsx b/src/lib/brand/components/Brand.jsx new file mode 100644 index 00000000..a42f4c81 --- /dev/null +++ b/src/lib/brand/components/Brand.jsx @@ -0,0 +1,70 @@ +import useBrand from "../hooks/useBrand" +import Image from "@/core/components/elements/Image/Image" + +import { Swiper, SwiperSlide } from "swiper/react" +import { Pagination, Autoplay } from "swiper" +import "swiper/css" +import "swiper/css/pagination" +import "swiper/css/autoplay" +import Divider from "@/core/components/elements/Divider/Divider" +import ImageSkeleton from "@/core/components/elements/Skeleton/ImageSkeleton" + +const swiperBanner = { + pagination: { dynamicBullets: true }, + autoplay: { + delay: 6000, + disableOnInteraction: false + }, + modules: [Pagination, Autoplay] +} + +const Brand = ({ id }) => { + const { brand } = useBrand({ id }) + + return ( + <> +
+ { brand.isLoading && } + { brand.data && ( + <> + + { brand.data?.banners?.map((banner, index) => ( + + {`Brand + + )) } + +
+
Produk dari brand:
+ { brand?.data?.logo && ( + {brand?.data?.name} + ) } + { !brand?.data?.logo && ( +
+ { brand?.data?.name } +
+ ) } +
+ + ) } +
+ + + ) +} + +export default Brand \ No newline at end of file -- cgit v1.2.3 From 347e28848fb063ffcb7f9268384409e57b7ef3ad Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 18 Feb 2023 22:08:07 +0700 Subject: change animation --- src/lib/brand/components/Brand.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/brand/components/Brand.jsx') diff --git a/src/lib/brand/components/Brand.jsx b/src/lib/brand/components/Brand.jsx index a42f4c81..c1215976 100644 --- a/src/lib/brand/components/Brand.jsx +++ b/src/lib/brand/components/Brand.jsx @@ -23,7 +23,7 @@ const Brand = ({ id }) => { return ( <> -
+
{ brand.isLoading && } { brand.data && ( <> @@ -44,7 +44,7 @@ const Brand = ({ id }) => { )) } -
+
Produk dari brand:
{ brand?.data?.logo && ( Date: Wed, 22 Feb 2023 11:03:34 +0700 Subject: prettier --- src/lib/brand/components/Brand.jsx | 66 +++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src/lib/brand/components/Brand.jsx') diff --git a/src/lib/brand/components/Brand.jsx b/src/lib/brand/components/Brand.jsx index c1215976..c338c4c4 100644 --- a/src/lib/brand/components/Brand.jsx +++ b/src/lib/brand/components/Brand.jsx @@ -1,13 +1,13 @@ -import useBrand from "../hooks/useBrand" -import Image from "@/core/components/elements/Image/Image" +import useBrand from '../hooks/useBrand' +import Image from '@/core/components/elements/Image/Image' -import { Swiper, SwiperSlide } from "swiper/react" -import { Pagination, Autoplay } from "swiper" -import "swiper/css" -import "swiper/css/pagination" -import "swiper/css/autoplay" -import Divider from "@/core/components/elements/Divider/Divider" -import ImageSkeleton from "@/core/components/elements/Skeleton/ImageSkeleton" +import { Swiper, SwiperSlide } from 'swiper/react' +import { Pagination, Autoplay } from 'swiper' +import 'swiper/css' +import 'swiper/css/pagination' +import 'swiper/css/autoplay' +import Divider from '@/core/components/elements/Divider/Divider' +import ImageSkeleton from '@/core/components/elements/Skeleton/ImageSkeleton' const swiperBanner = { pagination: { dynamicBullets: true }, @@ -20,51 +20,51 @@ const swiperBanner = { const Brand = ({ id }) => { const { brand } = useBrand({ id }) - + return ( <> -
- { brand.isLoading && } - { brand.data && ( +
+ {brand.isLoading && } + {brand.data && ( <> - { brand.data?.banners?.map((banner, index) => ( + {brand.data?.banners?.map((banner, index) => ( - {`Brand - )) } + ))} -
-
Produk dari brand:
- { brand?.data?.logo && ( - {brand?.data?.name} +
Produk dari brand:
+ {brand?.data?.logo && ( + {brand?.data?.name} - ) } - { !brand?.data?.logo && ( -
- { brand?.data?.name } + )} + {!brand?.data?.logo && ( +
+ {brand?.data?.name}
- ) } + )}
- ) } + )}
) } -export default Brand \ No newline at end of file +export default Brand -- cgit v1.2.3