fix the TimeEstimateCard opening
This commit is contained in:
@@ -1,19 +1,32 @@
|
||||
import { Radio, Space } from "antd";
|
||||
import { Radio, RadioChangeEvent, Space } from "antd";
|
||||
import ProText from "components/ProText";
|
||||
import styles from "./ProRatioGroups.module.css";
|
||||
|
||||
interface ProRatioGroupsProps {
|
||||
options: { label: string; value: string; price?: string }[];
|
||||
onRatioClick?: (value: string) => void;
|
||||
onChange?: (e: RadioChangeEvent) => void;
|
||||
value?: string;
|
||||
}
|
||||
|
||||
const ProRatioGroups = ({
|
||||
options,
|
||||
onRatioClick,
|
||||
onChange,
|
||||
value,
|
||||
...props
|
||||
}: ProRatioGroupsProps) => {
|
||||
const handleChange = (e: RadioChangeEvent) => {
|
||||
// If onChange is provided (from Form.Item), use it
|
||||
if (onChange) {
|
||||
onChange(e);
|
||||
}
|
||||
// Also call onRatioClick if provided (for backward compatibility)
|
||||
if (onRatioClick) {
|
||||
onRatioClick(e.target.value);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={styles.proRatioGroups}>
|
||||
<Radio.Group
|
||||
@@ -21,7 +34,7 @@ const ProRatioGroups = ({
|
||||
width: "100%",
|
||||
}}
|
||||
value={value}
|
||||
onChange={(e) => onRatioClick?.(e.target.value)}
|
||||
onChange={handleChange}
|
||||
{...props}
|
||||
>
|
||||
<Space direction="vertical" style={{ width: "100%" }}>
|
||||
|
||||
Reference in New Issue
Block a user