import { View } from "@tarojs/components";
import style from "./index.module.less";
interface Props {
  checked: boolean;
  onChange: (checked: boolean) => void;
}
const index = ({ checked = false, onChange }: Props) => {
  const handleSwitchChange = () => {
    onChange(!checked);
  };
  return (
    <View
      className={checked ? style.switchChecked : style.switch}
      onClick={handleSwitchChange}
    ></View>
  );
};
export default index;
