import React, { useState } from 'react';
import { LimitCurve } from '../index';
import { Button } from 'antd';

const Demos = () => {
  const [open, setOpen] = useState(false);
  const [sensors, setSensors] = useState('瞬时流量');

  const onOk = (data) => {
    setOpen(false);
    console.log(data);
  };

  const onCancel = () => {
    setOpen(false);
  };

  return (
    <>
      <Button
        onClick={() => {
          setOpen(true);
        }}
      >
        打开限制曲线
      </Button>
      <Button
        onClick={() => {
          setSensors('噪声');
        }}
      >
        改变sensors
      </Button>
      <LimitCurve
        open={open}
        onOk={onOk}
        onCancel={onCancel}
        deviceCode={'SYJ00000022'}
        deviceType={'水源井'}
        sensors={sensors}
      />
    </>
  );
};

export default Demos;
