/**
 * Created by baoyinghai on 6/4/17.
 */
import React from 'react';
import { iconWrapper } from '../../../../framework/utils/IconHelper';

const ICON_ID = 'icon-iconloading-copy';

export default class Loading extends React.Component {

  constructor(props) {
    super(props);
    this.refStr = 'loading-icon-' + this.props.index + '-' + new Date().getTime();
  }

  componentDidMount() {
    // this.isMounted = true;
    // const updateTime = 1000 / 60;
    // const rAF = window.requestAnimationFrame || function(cb) { setTimeout(cb, updateTime) };
    // const tag = document.querySelector('.' + this.refStr + '.' + ICON_ID);
    // let rotate = 0;
    // const step = () => {
    //   if (tag ) tag.style.transform = 'rotate(' + rotate + 'deg)';
    //   rotate = (rotate + 10) % 360;
    //   if (this.isMounted) rAF(step);
    // };
    // step();
  }

  componentWillUnmount() {
    // this.isMounted = false;
  }

  render() {
    return iconWrapper(this.refStr + ' ' + ICON_ID, undefined, undefined, undefined);
  }
}

