import * as React from 'react'; import { Checkbox, css, ISize, fitContentToBounds } from '@fluentui/react'; import { SignalField, NewSignal, CommentsSignal, TrendingSignal, SharedSignal, Tile, getTileLayout, renderTileWithLayout, } from '@fluentui/react-experiments'; import { lorem } from '@fluentui/example-data'; import * as TileExampleStylesModule from './Tile.Example.scss'; const TileExampleStyles = TileExampleStylesModule as any; const ITEMS: { name: string; activity: string }[] = [ { name: lorem(2), activity: lorem(6), }, { name: lorem(2), activity: lorem(6), }, { name: lorem(2), activity: lorem(6), }, { name: lorem(2), activity: lorem(6), }, { name: lorem(2), activity: lorem(6), }, ]; interface IDocumentTileWithThumbnailProps { originalImageSize: ISize; showForeground: boolean; item: typeof ITEMS[0]; } const DocumentTileWithThumbnail: React.FunctionComponent = ( props: IDocumentTileWithThumbnailProps, ): JSX.Element => { const tile = ( }>{props.item.name}} itemActivity={{'12'}}>{props.item.activity}} foreground={} hideForeground={!props.showForeground} showForegroundFrame={true} /> ); const { foregroundSize = { width: 0, height: 0 } } = getTileLayout(tile); const imageSize = fitContentToBounds({ contentSize: props.originalImageSize, boundsSize: foregroundSize, mode: 'contain', }); return (
{renderTileWithLayout(tile, { foreground: ( ), })}
); }; export interface ITileDocumentExampleState { imagesLoaded: boolean; } export class TileDocumentExample extends React.Component<{}, ITileDocumentExampleState> { constructor(props: {}) { super(props); this.state = { imagesLoaded: true, }; } public render(): JSX.Element { const { imagesLoaded } = this.state; return (

Document thumbnail

Document icon

}>{ITEMS[3].name}} itemActivity={}>{ITEMS[3].activity}} foreground={ } showForegroundFrame={true} />
); } private _onImagesLoadedChanged = (event: React.FormEvent, checked: boolean): void => { this.setState({ imagesLoaded: checked, }); }; }