diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-13 17:09:53 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-02-13 17:09:53 +0700 |
| commit | a88dbd7f7b271e78290506fdc61d68adba5d0019 (patch) | |
| tree | 43f89a761f7b72cc936e45004a4fbda2f445f92c /src/components | |
| parent | ada443445767679dd2d2b2c889bfac02609778b8 (diff) | |
Fixing
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/elements/ConfirmAlert.js | 4 | ||||
| -rw-r--r-- | src/components/elements/Image.js | 10 | ||||
| -rw-r--r-- | src/components/layouts/AppBar.js | 6 | ||||
| -rw-r--r-- | src/components/products/ProductCategories.js | 16 | ||||
| -rw-r--r-- | src/components/products/ProductSlider.js | 2 | ||||
| -rw-r--r-- | src/components/transactions/TransactionStatusBadge.js | 14 | ||||
| -rw-r--r-- | src/components/variants/VariantCard.js | 9 | ||||
| -rw-r--r-- | src/components/variants/VariantGroupCard.js | 31 |
8 files changed, 73 insertions, 19 deletions
diff --git a/src/components/elements/ConfirmAlert.js b/src/components/elements/ConfirmAlert.js index 96f4029d..37e6a450 100644 --- a/src/components/elements/ConfirmAlert.js +++ b/src/components/elements/ConfirmAlert.js @@ -16,8 +16,8 @@ const ConfirmAlert = ({ <p className="h2 mb-2">{title}</p> <p className="text-gray_r-11 mb-6">{caption}</p> <div className="flex gap-x-2"> - <button className="flex-1 btn-light" onClick={onClose}>{closeText}</button> - <button className="flex-1 btn-red" onClick={onSubmit}>{submitText}</button> + <button className="flex-1 btn-yellow" onClick={onClose}>{closeText}</button> + <button className="flex-1 btn-solid-red" onClick={onSubmit}>{submitText}</button> </div> </div> </> diff --git a/src/components/elements/Image.js b/src/components/elements/Image.js index 8981547a..e03d81f7 100644 --- a/src/components/elements/Image.js +++ b/src/components/elements/Image.js @@ -1,7 +1,7 @@ import { LazyLoadImage } from "react-lazy-load-image-component"; import "react-lazy-load-image-component/src/effects/opacity.css"; -export default function Image({ src, alt, className = "" }) { +const Image = ({ src, alt, className = "" }) => { return ( <LazyLoadImage effect="opacity" @@ -10,4 +10,10 @@ export default function Image({ src, alt, className = "" }) { className={className} /> ); -}
\ No newline at end of file +} + +Image.defaultProps = { + test: false +} + +export default Image
\ No newline at end of file diff --git a/src/components/layouts/AppBar.js b/src/components/layouts/AppBar.js index 534cfe02..fe74c940 100644 --- a/src/components/layouts/AppBar.js +++ b/src/components/layouts/AppBar.js @@ -1,4 +1,4 @@ -import { Bars3Icon, ChevronLeftIcon, HeartIcon, HomeIcon } from "@heroicons/react/24/outline"; +import { Bars3Icon, ChevronLeftIcon, HomeIcon, ShoppingCartIcon } from "@heroicons/react/24/outline"; import Head from "next/head"; import { useRouter } from "next/router"; import Link from "../elements/Link"; @@ -28,8 +28,8 @@ const AppBar = ({ title }) => { {/* --- Start Icons */} <div className="flex gap-x-4 items-center"> - <Link href="/my/wishlist"> - <HeartIcon className="w-6 stroke-2 text-gray_r-12"/> + <Link href="/shop/cart"> + <ShoppingCartIcon className="w-6 stroke-2 text-gray_r-12"/> </Link> <Link href="/"> <HomeIcon className="w-6 stroke-2 text-gray_r-12"/> diff --git a/src/components/products/ProductCategories.js b/src/components/products/ProductCategories.js index 54ca854b..3b671f29 100644 --- a/src/components/products/ProductCategories.js +++ b/src/components/products/ProductCategories.js @@ -18,7 +18,7 @@ const ProductCategory = ({ id }) => { }, [id, content]); return ( - <div className="my-6 px-4 pt-4 relative"> + <div className="p-4 relative bg-yellow_r-2"> { content ? ( <ProductSlider products={{ @@ -50,9 +50,13 @@ export default function ProductCategories() { getContentIds(); }, [ contentIds ]); - return contentIds.map((contentId) => ( - <LazyLoadComponent placeholder={<SkeletonProduct/>} key={contentId}> - <ProductCategory id={contentId} /> - </LazyLoadComponent> - )); + return ( + <div className="flex flex-col gap-y-6"> + { contentIds.map((contentId) => ( + <LazyLoadComponent placeholder={<SkeletonProduct/>} key={contentId}> + <ProductCategory id={contentId} /> + </LazyLoadComponent> + )) } + </div> + ) }
\ No newline at end of file diff --git a/src/components/products/ProductSlider.js b/src/components/products/ProductSlider.js index 11fab069..662a6511 100644 --- a/src/components/products/ProductSlider.js +++ b/src/components/products/ProductSlider.js @@ -19,7 +19,7 @@ export default function ProductSlider({ return ( <> { bannerMode && ( - <Image src={products.banner.image} alt={products.banner.name} className={`absolute rounded-r top-0 left-0 h-full max-w-[52%] idt-transition border border-gray_r-6 ` + (activeIndex > 0 ? 'opacity-10' : 'opacity-100')} /> + <Image src={products.banner.image} alt={products.banner.name} className={`absolute rounded-r top-0 left-0 h-full max-w-[52%] idt-transition border border-gray_r-6 ` + (activeIndex > 0 ? 'opacity-0' : 'opacity-100')} /> ) } <Swiper freeMode={true} slidesPerView={2.2} spaceBetween={8} onSlideChange={swiperSliderFirstMove} prefix="product"> { bannerMode && ( diff --git a/src/components/transactions/TransactionStatusBadge.js b/src/components/transactions/TransactionStatusBadge.js index d8da6033..f94fd3fd 100644 --- a/src/components/transactions/TransactionStatusBadge.js +++ b/src/components/transactions/TransactionStatusBadge.js @@ -6,7 +6,7 @@ const TransactionStatusBadge = ({ status }) => { switch (status) { case 'cancel': badgeProps.className.push('badge-solid-red'); - badgeProps.text = 'Batal' + badgeProps.text = 'Pesanan Batal' break; case 'draft': badgeProps.className.push('badge-red'); @@ -14,19 +14,23 @@ const TransactionStatusBadge = ({ status }) => { break; case 'waiting': badgeProps.className.push('badge-yellow'); - badgeProps.text = 'Dikonfirmasi' + badgeProps.text = 'Pesanan diterima' break; case 'sale': badgeProps.className.push('badge-yellow'); - badgeProps.text = 'Pesanan Diproses' + badgeProps.text = 'Pesanan diproses' break; case 'shipping': badgeProps.className.push('badge-green'); - badgeProps.text = 'Pesanan Dikirim' + badgeProps.text = 'Pesanan dikirim' + break; + case 'partial_shipping': + badgeProps.className.push('badge-green'); + badgeProps.text = 'Dikirim sebagian' break; case 'done': badgeProps.className.push('badge-solid-green'); - badgeProps.text = 'Selesai' + badgeProps.text = 'Pesanan Selesai' break; } badgeProps.className = badgeProps.className.join(' '); diff --git a/src/components/variants/VariantCard.js b/src/components/variants/VariantCard.js index 2d27371b..a821480c 100644 --- a/src/components/variants/VariantCard.js +++ b/src/components/variants/VariantCard.js @@ -41,6 +41,15 @@ export default function VariantCard({ {product.code || '-'} {product.attributes.length > 0 ? ` ・ ${product.attributes.join(', ')}` : ''} </p> + <div className="flex flex-wrap gap-x-1 items-center mt-auto"> + {product.price.discount_percentage > 0 && ( + <> + <p className="text-caption-2 text-gray_r-11 line-through">{currencyFormat(product.price.price)}</p> + <span className="badge-red">{product.price.discount_percentage}%</span> + </> + )} + <p className="text-caption-2 text-gray_r-12">{currencyFormat(product.price.price_discount)}</p> + </div> <p className="text-caption-2 text-gray_r-11 mt-1"> {currencyFormat(product.price.price_discount)} × {product.quantity} Barang </p> diff --git a/src/components/variants/VariantGroupCard.js b/src/components/variants/VariantGroupCard.js new file mode 100644 index 00000000..98f2d739 --- /dev/null +++ b/src/components/variants/VariantGroupCard.js @@ -0,0 +1,31 @@ +import { useState } from "react" +import VariantCard from "./VariantCard" + +export default function VariantGroupCard({ + variants, + ...props +}) { + const [ showAll, setShowAll ] = useState(false) + const variantsToShow = showAll ? variants : variants.slice(0, 2) + + return ( + <> + { variantsToShow?.map((variant, index) => ( + <VariantCard + key={index} + data={variant} + {...props} + /> + )) } + { variants.length > 2 && ( + <button + type="button" + className="btn-light py-2 w-full" + onClick={() => setShowAll(!showAll)} + > + { !showAll ? 'Lihat Semua' : 'Tutup' } + </button> + ) } + </> + ) +}
\ No newline at end of file |
