1 | import { __assign, __extends } from "tslib";
|
2 | import * as React from 'react';
|
3 | import { Icon } from '../../Icon';
|
4 | import { Image } from '../../Image';
|
5 | import { classNamesFunction, initializeComponentRef } from '../../Utilities';
|
6 | var getClassNames = classNamesFunction();
|
7 |
|
8 |
|
9 |
|
10 | var DocumentCardImageBase = (function (_super) {
|
11 | __extends(DocumentCardImageBase, _super);
|
12 | function DocumentCardImageBase(props) {
|
13 | var _this = _super.call(this, props) || this;
|
14 | _this._onImageLoad = function () {
|
15 | _this.setState({ imageHasLoaded: true });
|
16 | };
|
17 | initializeComponentRef(_this);
|
18 | _this.state = { imageHasLoaded: false };
|
19 | return _this;
|
20 | }
|
21 | DocumentCardImageBase.prototype.render = function () {
|
22 | var _a = this.props, styles = _a.styles, width = _a.width, height = _a.height, imageFit = _a.imageFit, imageSrc = _a.imageSrc;
|
23 | this._classNames = getClassNames(styles, this.props);
|
24 | return (React.createElement("div", { className: this._classNames.root },
|
25 | imageSrc && (React.createElement(Image, { width: width, height: height, imageFit: imageFit, src: imageSrc, role: "presentation", alt: "", onLoad: this._onImageLoad })),
|
26 | this.state.imageHasLoaded ? this._renderCornerIcon() : this._renderCenterIcon()));
|
27 | };
|
28 | DocumentCardImageBase.prototype._renderCenterIcon = function () {
|
29 | var iconProps = this.props.iconProps;
|
30 | return (React.createElement("div", { className: this._classNames.centeredIconWrapper },
|
31 | React.createElement(Icon, __assign({ className: this._classNames.centeredIcon }, iconProps))));
|
32 | };
|
33 | DocumentCardImageBase.prototype._renderCornerIcon = function () {
|
34 | var iconProps = this.props.iconProps;
|
35 | return React.createElement(Icon, __assign({ className: this._classNames.cornerIcon }, iconProps));
|
36 | };
|
37 | return DocumentCardImageBase;
|
38 | }(React.Component));
|
39 | export { DocumentCardImageBase };
|
40 |
|
\ | No newline at end of file |