import * as tslib_1 from "tslib";
import * as React from 'react';
import { Icon } from '../../Icon';
import { Image } from '../../Image';
import { BaseComponent, classNamesFunction } from '../../Utilities';
var getClassNames = classNamesFunction();
/**
 * {@docCategory DocumentCard}
 */
var DocumentCardImageBase = /** @class */ (function (_super) {
    tslib_1.__extends(DocumentCardImageBase, _super);
    function DocumentCardImageBase(props) {
        var _this = _super.call(this, props) || this;
        _this._onImageLoad = function () {
            _this.setState({ imageHasLoaded: true });
        };
        _this.state = { imageHasLoaded: false };
        return _this;
    }
    DocumentCardImageBase.prototype.render = function () {
        var _a = this.props, styles = _a.styles, width = _a.width, height = _a.height, imageFit = _a.imageFit, imageSrc = _a.imageSrc;
        this._classNames = getClassNames(styles, this.props);
        return (React.createElement("div", { className: this._classNames.root },
            imageSrc && (React.createElement(Image, { width: width, height: height, imageFit: imageFit, src: imageSrc, role: "presentation", alt: "", onLoad: this._onImageLoad })),
            this.state.imageHasLoaded ? this._renderCornerIcon() : this._renderCenterIcon()));
    };
    DocumentCardImageBase.prototype._renderCenterIcon = function () {
        var iconProps = this.props.iconProps;
        return (React.createElement("div", { className: this._classNames.centeredIconWrapper },
            React.createElement(Icon, tslib_1.__assign({ className: this._classNames.centeredIcon }, iconProps))));
    };
    DocumentCardImageBase.prototype._renderCornerIcon = function () {
        var iconProps = this.props.iconProps;
        return React.createElement(Icon, tslib_1.__assign({ className: this._classNames.cornerIcon }, iconProps));
    };
    return DocumentCardImageBase;
}(BaseComponent));
export { DocumentCardImageBase };
//# sourceMappingURL=DocumentCardImage.base.js.map