import { useState } from "react";
import { Month, Button } from "@svar-ui/react-core";
export default function Demo() {
const [value, setValue] = useState(new Date());
const [showMonth, setShowMonth] = useState(false);
const show = () => {
setShowMonth(true);
};
const handleChange = (ev) => {
setValue(ev.value);
};
const handleCancel = () => {
setShowMonth(false);
};
return (
<div className="demo-box" style={{ width: 300 }}>
<div style={{ margin: 20 }}>{String(value)}</div>
<div style={{ margin: 20 }}>
<Button onClick={show}>Open month</Button>
</div>
{showMonth && (
<Month
value={value}
part="normal"
current={value}
onChange={handleChange}
onCancel={handleCancel}
/>
)}
</div>
);
}