import React from 'react';
import { Switch, Typography } from 'antd';
import { jsxs as _jsxs } from "react/jsx-runtime";
import { jsx as _jsx } from "react/jsx-runtime";
const {
  Text
} = Typography;
const SettingSwitch = ({
  label,
  storageKey
}) => {
  const [checked, setChecked] = React.useState(localStorage.getItem(storageKey) === 'true');
  const handleChange = checked => {
    setChecked(checked);
    localStorage.setItem(storageKey, checked ? 'true' : 'false');
    window.location.reload();
  };
  return /*#__PURE__*/_jsxs("div", {
    children: [/*#__PURE__*/_jsxs(Text, {
      children: [label, ": "]
    }), /*#__PURE__*/_jsx(Switch, {
      checked: checked,
      onChange: handleChange
    }), " (key: ", storageKey, ", default: false)"]
  });
};
export default SettingSwitch;
//# sourceMappingURL=SettingSwitch.js.map