fix problem
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import InputField from '@/components/input/InputField';
|
import InputField from '@/components/input/InputField';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import { Cup, Icon, TickCircle, Ticket, Trash } from 'iconsax-react';
|
import { TickCircle, Trash } from 'iconsax-react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useApplyCoupon, useRemoveCoupon } from '../../hooks/useOrderData';
|
import { useApplyCoupon, useRemoveCoupon } from '../../hooks/useOrderData';
|
||||||
import Button from '@/components/button/PrimaryButton';
|
import Button from '@/components/button/PrimaryButton';
|
||||||
@@ -20,10 +20,8 @@ type CouponSectionProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const CouponSection = ({
|
export const CouponSection = ({
|
||||||
couponType,
|
|
||||||
couponCode,
|
couponCode,
|
||||||
couponCodeError,
|
couponCodeError,
|
||||||
onCouponTypeChange,
|
|
||||||
onCouponCodeChange,
|
onCouponCodeChange,
|
||||||
}: CouponSectionProps) => {
|
}: CouponSectionProps) => {
|
||||||
|
|
||||||
@@ -32,10 +30,6 @@ export const CouponSection = ({
|
|||||||
const { mutate: removeCoupon, isPending: isRemoving } = useRemoveCoupon();
|
const { mutate: removeCoupon, isPending: isRemoving } = useRemoveCoupon();
|
||||||
const { data: cartItems } = useGetCartItems();
|
const { data: cartItems } = useGetCartItems();
|
||||||
const [isApplied, setIsApplied] = useState<boolean>(false);
|
const [isApplied, setIsApplied] = useState<boolean>(false);
|
||||||
const couponOptions: Array<{ id: string, label: string, icon: Icon }> = [
|
|
||||||
{ id: '0', label: t("SectionCoupon.InputCouponType.Options.Discount"), icon: Cup },
|
|
||||||
{ id: '1', label: t("SectionCoupon.InputCouponType.Options.GiftCard"), icon: Ticket },
|
|
||||||
];
|
|
||||||
|
|
||||||
const handleApplyCoupon = () => {
|
const handleApplyCoupon = () => {
|
||||||
applyCoupon(couponCode, {
|
applyCoupon(couponCode, {
|
||||||
@@ -84,7 +78,7 @@ export const CouponSection = ({
|
|||||||
<h3 className="text-sm2 font-medium leading-5">{t("SectionCoupon.Title")}</h3>
|
<h3 className="text-sm2 font-medium leading-5">{t("SectionCoupon.Title")}</h3>
|
||||||
|
|
||||||
<div className='flex flex-col gap-5 mt-6'>
|
<div className='flex flex-col gap-5 mt-6'>
|
||||||
{couponOptions.map(({ id, label, icon: Icon }) => (
|
{/* {couponOptions.map(({ id, label, icon: Icon }) => (
|
||||||
<div key={id} className='flex items-center'>
|
<div key={id} className='flex items-center'>
|
||||||
<label className='flex items-center gap-2 w-full' htmlFor={`couponType${id}`}>
|
<label className='flex items-center gap-2 w-full' htmlFor={`couponType${id}`}>
|
||||||
<Icon
|
<Icon
|
||||||
@@ -103,7 +97,7 @@ export const CouponSection = ({
|
|||||||
id={`couponType${id}`}
|
id={`couponType${id}`}
|
||||||
className='size-4 accent-primary' />
|
className='size-4 accent-primary' />
|
||||||
</div>
|
</div>
|
||||||
))}
|
))} */}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isApplied ? (
|
{isApplied ? (
|
||||||
@@ -127,7 +121,7 @@ export const CouponSection = ({
|
|||||||
<InputField
|
<InputField
|
||||||
autoComplete='off'
|
autoComplete='off'
|
||||||
className={clsx(
|
className={clsx(
|
||||||
'relative mt-6',
|
'relative',
|
||||||
couponCodeError.trim() === 'valid' && 'text-emerald-400 **:stroke-emerald-400 ring ring-emerald-400'
|
couponCodeError.trim() === 'valid' && 'text-emerald-400 **:stroke-emerald-400 ring ring-emerald-400'
|
||||||
)}
|
)}
|
||||||
placeholder={t("SectionCoupon.InputCouponCode.Placeholder")}
|
placeholder={t("SectionCoupon.InputCouponCode.Placeholder")}
|
||||||
|
|||||||
Reference in New Issue
Block a user