Make Custom Item in Form Item
how to make this
to be like this
<Form.Item
label="Status"
name={["status"]}
rules={[{required: true,},]}
>
<Input />
</Form.Item> <Form.Item
label="Status"
name={["status"]}
rules={[{required: true,},]}
>
<Input />
</Form.Item>to be like this
<Table.Column
dataIndex="status"
title="Status"
render={(value: string) => {
// Define a function to determine color and icon based on status
const getStatusProps = (status: string) => {
switch (status) {
case "diproses":
return {
color: "warning",
icon: <ExclamationCircleOutlined />,
};
case "selesai":
return {
color: "success",
icon: <CheckCircleOutlined />,
};
default:
return {
color: "default",
icon: <CheckCircleOutlined />,
}; // Default case
}
};
const { color, icon } = getStatusProps(value);
// Use the getStatusProps function to dynamically set the color and icon
return (
<TagField icon={icon} color={color} value={value} />
);
}}
/> <Table.Column
dataIndex="status"
title="Status"
render={(value: string) => {
// Define a function to determine color and icon based on status
const getStatusProps = (status: string) => {
switch (status) {
case "diproses":
return {
color: "warning",
icon: <ExclamationCircleOutlined />,
};
case "selesai":
return {
color: "success",
icon: <CheckCircleOutlined />,
};
default:
return {
color: "default",
icon: <CheckCircleOutlined />,
}; // Default case
}
};
const { color, icon } = getStatusProps(value);
// Use the getStatusProps function to dynamically set the color and icon
return (
<TagField icon={icon} color={color} value={value} />
);
}}
/>