import { __extends } from "tslib";
import * as React from 'react';
import { Checkbox } from '@fluentui/react/lib/Checkbox';
import { SignalField, NewSignal, CommentsSignal, SharedSignal, Tile } from '@fluentui/react-experiments';
import { FolderCover, getFolderCoverLayout, renderFolderCoverWithLayout, } from '@fluentui/react-experiments/lib/FolderCover';
import { lorem } from '@fluentui/example-data';
import { css, fitContentToBounds } from '@fluentui/react-experiments/lib/Utilities';
import * as TileExampleStylesModule from './Tile.Example.scss';
var TileExampleStyles = TileExampleStylesModule;
var ITEMS = [
    {
        name: lorem(2),
        activity: lorem(6),
        childCount: 4,
    },
    {
        name: lorem(2),
        activity: lorem(6),
    },
    {
        name: lorem(2),
        activity: lorem(6),
        isShared: true,
        childCount: 4,
    },
    {
        name: lorem(2),
        activity: lorem(6),
        childCount: 4,
    },
    {
        name: lorem(2),
        activity: lorem(6),
        childCount: 4,
    },
];
var FolderTileWithThumbnail = function (props) {
    var _a;
    var folderCover = (React.createElement(FolderCover, { folderCoverSize: props.size, folderCoverType: props.folderCoverType, metadata: props.item.childCount, signal: props.item.isShared ? React.createElement(SharedSignal, null) : null }));
    var contentSize = getFolderCoverLayout(folderCover).contentSize;
    var imageSize = props.originalImageSize
        ? fitContentToBounds({
            contentSize: props.originalImageSize,
            boundsSize: contentSize,
            mode: 'contain',
        })
        : undefined;
    return (React.createElement("div", { className: css(TileExampleStyles.tile, (_a = {},
            _a[TileExampleStyles.largeTile] = props.size === 'large',
            _a[TileExampleStyles.smallTile] = props.size === 'small',
            _a)) },
        React.createElement(Tile, { tileSize: props.size, itemName: React.createElement(SignalField, { before: React.createElement(NewSignal, null) }, props.item.name), itemActivity: React.createElement(SignalField, { before: React.createElement(CommentsSignal, null, '12') }, props.item.activity), foreground: React.createElement("span", { className: css(TileExampleStylesModule.tileFolder) }, renderFolderCoverWithLayout(folderCover, {
                children: imageSize ? (React.createElement("img", { src: "//via.placeholder.com/" + Math.round(imageSize.width) + "x" + Math.round(imageSize.height), className: css(TileExampleStyles.tileImage) })) : null,
            })) })));
};
var TileFolderExample = /** @class */ (function (_super) {
    __extends(TileFolderExample, _super);
    function TileFolderExample(props) {
        var _this = _super.call(this, props) || this;
        _this._onIsLargeChanged = function (event, checked) {
            _this.setState({
                size: checked ? 'large' : 'small',
            });
        };
        _this.state = {
            size: 'large',
        };
        return _this;
    }
    TileFolderExample.prototype.render = function () {
        var size = this.state.size;
        return (React.createElement("div", null,
            React.createElement(Checkbox, { label: "Use large tiles", checked: size === 'large', onChange: this._onIsLargeChanged }),
            React.createElement("h3", null, "Folder"),
            React.createElement(FolderTileWithThumbnail, { originalImageSize: {
                    width: 400,
                    height: 300,
                }, item: ITEMS[0], size: size }),
            React.createElement(FolderTileWithThumbnail, { item: ITEMS[1], folderCoverType: "media", size: size }),
            React.createElement(FolderTileWithThumbnail, { originalImageSize: {
                    width: 300,
                    height: 400,
                }, item: ITEMS[2], folderCoverType: "media", size: size }),
            React.createElement(FolderTileWithThumbnail, { originalImageSize: {
                    width: 40,
                    height: 40,
                }, item: ITEMS[3], folderCoverType: "media", size: size }),
            React.createElement(FolderTileWithThumbnail, { originalImageSize: {
                    width: 16,
                    height: 16,
                }, item: ITEMS[4], folderCoverType: "media", size: size })));
    };
    return TileFolderExample;
}(React.Component));
export { TileFolderExample };
//# sourceMappingURL=Tile.Folder.Example.js.map