import React from 'react';
import './index.less';
import Assets from '@src/components/Assets';

function Switch(props) {
  const { checked, children, onChange } = props;
  return (
    <div className="switch" onClick={() => {
      if (onChange) onChange(!checked);
    }}>
      <Assets name={checked ? 'swich_on' : 'swich_off'} />
      {children}
    </div>
  );
}
Switch.propTypes = {};
export default Switch;