CouponBottomSheet: ehancements
This commit is contained in:
@@ -5,6 +5,7 @@ import ProRatioGroups from "../ProRatioGroups/ProRatioGroups";
|
|||||||
import { colors } from "ThemeConstants";
|
import { colors } from "ThemeConstants";
|
||||||
import { updateCoupon } from "features/order/orderSlice";
|
import { updateCoupon } from "features/order/orderSlice";
|
||||||
import { useAppDispatch } from "redux/hooks";
|
import { useAppDispatch } from "redux/hooks";
|
||||||
|
import { Button } from "antd";
|
||||||
|
|
||||||
interface CouponBottomSheetProps {
|
interface CouponBottomSheetProps {
|
||||||
isOpen: boolean;
|
isOpen: boolean;
|
||||||
@@ -26,9 +27,9 @@ export function CouponBottomSheet({
|
|||||||
setValue(initialValue);
|
setValue(initialValue);
|
||||||
}, [initialValue]);
|
}, [initialValue]);
|
||||||
|
|
||||||
const handleSave = (selectedValue: string) => {
|
const handleSave = () => {
|
||||||
onSave(selectedValue);
|
onSave(value);
|
||||||
dispatch(updateCoupon(selectedValue));
|
dispatch(updateCoupon(value));
|
||||||
onClose();
|
onClose();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,10 +43,9 @@ export function CouponBottomSheet({
|
|||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
onClose={handleCancel}
|
onClose={handleCancel}
|
||||||
title={t("cart.coupon")}
|
title={t("cart.coupon")}
|
||||||
showCloseButton={false}
|
|
||||||
initialSnap={1}
|
initialSnap={1}
|
||||||
height={350}
|
height={385}
|
||||||
snapPoints={[350]}
|
snapPoints={[385]}
|
||||||
>
|
>
|
||||||
<div style={{ padding: "16px 0" }}>
|
<div style={{ padding: "16px 0" }}>
|
||||||
<ProRatioGroups
|
<ProRatioGroups
|
||||||
@@ -67,7 +67,7 @@ export function CouponBottomSheet({
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
value={value}
|
value={value}
|
||||||
onRatioClick={handleSave}
|
onRatioClick={(value) => setValue(value)}
|
||||||
showDivider={true}
|
showDivider={true}
|
||||||
optionsStyle={{
|
optionsStyle={{
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -80,6 +80,28 @@ export function CouponBottomSheet({
|
|||||||
color: colors.primary,
|
color: colors.primary,
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
style={{
|
||||||
|
display: "flex",
|
||||||
|
gap: 12,
|
||||||
|
marginTop: 20,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
type="primary"
|
||||||
|
style={{
|
||||||
|
flex: 1,
|
||||||
|
boxShadow: "none",
|
||||||
|
height: 48,
|
||||||
|
width: "100%",
|
||||||
|
}}
|
||||||
|
onClick={handleSave}
|
||||||
|
disabled={!value}
|
||||||
|
>
|
||||||
|
{t("cart.save")}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</ProBottomSheet>
|
</ProBottomSheet>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user