Spin.js 783 Bytes
import template from "./Spin.html";

class Spin {

    state = {
        className: [],
        hasChildren: false,
    };

    constructor($element, $attrs, $controllers, $transclude) {
        this.state.className = ["ant-spin", "ant-spin-spinning"];

        if ($transclude()) {
            let len = $transclude().lenght;
            if (len > 0) {
                this.state.hasChildren = true;
            }
        }

        if (this.size === "small") {
            this.state.className.splice(1, 0, "ant-spin-sm");
        }

        if (this.size === "large") {
            this.state.className.splice(1, 0, "ant-spin-lg");
        }
    }

    render() {
        return template;
    }
}

Spin.propTypes = {
    size: PropTypes.string,
    spinning: PropTypes.boolean,
}