index.js 513 B

123456789101112131415161718
  1. import React, { Component } from 'react';
  2. import './index.less';
  3. import Assets from '@src/components/Assets';
  4. export default class Switch extends Component {
  5. render() {
  6. const { checked, size = 'big', onClick } = this.props;
  7. return (
  8. <div className={`g-switch-wrapper ${checked ? 'checked' : ''} ${size}`}>
  9. <Assets
  10. className="g-switch"
  11. name={`swich_${checked ? 'on' : 'off'}_${size}`}
  12. onClick={() => onClick && onClick()}
  13. />
  14. </div>
  15. );
  16. }
  17. }