UNPKG

@uifabric/experiments

Version:

Experimental React components for building experiences for Office 365.

124 lines 7.41 kB
define(["require", "exports", "tslib", "react", "../../../Utilities", "../Tile", "../../Shimmer/ShimmerGap/ShimmerGap", "../../Shimmer/ShimmerElementsGroup/ShimmerElementsGroup", "../../Shimmer/Shimmer.types"], function (require, exports, tslib_1, React, Utilities_1, Tile_1, ShimmerGap_1, ShimmerElementsGroup_1, Shimmer_types_1) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var ShimmerTileLayoutValues = { largeSquareWidth: 96, largeSquareHeight: 96, largeNameWidth: 144, largeNameHeight: 7, largeActivityWidth: 96, largeActivityHeight: 7, smallSquareWidth: 62, smallSquareHeight: 61, smallNameWidth: 106, smallNameHeight: 5, smallActivityWidth: 62, smallActivityHeight: 5 }; var PLACEHOLDER_SIZES = { small: { squareWidth: ShimmerTileLayoutValues.smallSquareWidth, squareHeight: ShimmerTileLayoutValues.smallSquareHeight, nameWidth: ShimmerTileLayoutValues.smallNameWidth, nameHeight: ShimmerTileLayoutValues.smallNameHeight, activityWidth: ShimmerTileLayoutValues.smallActivityWidth, activityHeight: ShimmerTileLayoutValues.smallActivityHeight }, large: { squareWidth: ShimmerTileLayoutValues.largeSquareWidth, squareHeight: ShimmerTileLayoutValues.largeSquareHeight, nameWidth: ShimmerTileLayoutValues.largeNameWidth, nameHeight: ShimmerTileLayoutValues.largeNameHeight, activityWidth: ShimmerTileLayoutValues.largeActivityWidth, activityHeight: ShimmerTileLayoutValues.largeActivityHeight } }; var getClassNames = Utilities_1.classNamesFunction(); var ShimmerTileBase = /** @class */ (function (_super) { tslib_1.__extends(ShimmerTileBase, _super); function ShimmerTileBase(props) { return _super.call(this, props) || this; } ShimmerTileBase.prototype.render = function () { var _a = this.props, styles = _a.styles, _b = _a.contentSize, contentSize = _b === void 0 ? { width: 176, height: 171 } : _b, _c = _a.itemActivity, itemActivity = _c === void 0 ? true : _c, _d = _a.itemName, itemName = _d === void 0 ? true : _d, _e = _a.itemThumbnail, itemThumbnail = _e === void 0 ? true : _e, _f = _a.tileSize, tileSize = _f === void 0 ? 'large' : _f; var _g = Tile_1.TileLayoutSizes[tileSize], nameplatePadding = _g.nameplatePadding, nameplateMargin = _g.nameplateMargin, nameplateActivityHeight = _g.nameplateActivityHeight, nameplateNameHeight = _g.nameplateNameHeight; var _h = PLACEHOLDER_SIZES[tileSize], squareWidth = _h.squareWidth, squareHeight = _h.squareHeight, nameWidth = _h.nameWidth, nameHeight = _h.nameHeight, activityWidth = _h.activityWidth, activityHeight = _h.activityHeight; var nameplateHeight = 0; if (itemName || itemActivity) { nameplateHeight += nameplatePadding * 2; if (itemName) { nameplateHeight += nameplateNameHeight; } if (itemActivity) { nameplateHeight += nameplateActivityHeight + nameplateMargin; } } this._classNames = getClassNames(styles, {}); return (React.createElement("div", { className: this._classNames.root }, React.createElement(ShimmerGap_1.ShimmerGap, { widthInPixel: contentSize.width, height: contentSize.height - squareHeight - nameplateHeight }), React.createElement(ShimmerElementsGroup_1.ShimmerElementsGroup, { shimmerElements: [ { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: (contentSize.width - squareWidth) / 2, height: squareHeight }, itemThumbnail ? { type: Shimmer_types_1.ShimmerElementType.line, widthInPixel: squareWidth, height: squareHeight } : { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: squareWidth, height: squareHeight }, { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: (contentSize.width - squareWidth) / 2, height: squareHeight } ] }), itemActivity || itemName ? (React.createElement("div", null, React.createElement(ShimmerGap_1.ShimmerGap, { widthInPixel: contentSize.width, height: nameplatePadding }), itemName ? (React.createElement(ShimmerElementsGroup_1.ShimmerElementsGroup, { shimmerElements: [ { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: (contentSize.width - nameWidth) / 2, height: nameplateNameHeight }, { type: Shimmer_types_1.ShimmerElementType.line, widthInPixel: nameWidth, height: nameHeight }, { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: (contentSize.width - nameWidth) / 2, height: nameplateNameHeight } ] })) : null, itemActivity ? (React.createElement(ShimmerElementsGroup_1.ShimmerElementsGroup, { shimmerElements: [ { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: (contentSize.width - activityWidth) / 2, height: nameplateActivityHeight }, { type: Shimmer_types_1.ShimmerElementType.line, widthInPixel: activityWidth, height: activityHeight }, { type: Shimmer_types_1.ShimmerElementType.gap, widthInPixel: (contentSize.width - activityWidth) / 2, height: nameplateActivityHeight } ] })) : null, React.createElement(ShimmerGap_1.ShimmerGap, { widthInPixel: contentSize.width, height: nameplatePadding }))) : null)); }; return ShimmerTileBase; }(Utilities_1.BaseComponent)); exports.ShimmerTileBase = ShimmerTileBase; }); //# sourceMappingURL=ShimmerTile.base.js.map