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, FolderCoverType, } from '@fluentui/react-experiments/lib/FolderCover'; import { lorem } from '@fluentui/example-data'; import { css, ISize, fitContentToBounds } from '@fluentui/react-experiments/lib/Utilities'; import * as TileExampleStylesModule from './Tile.Example.scss'; const TileExampleStyles = TileExampleStylesModule as any; const ITEMS: { name: string; activity: string; isShared?: boolean; childCount?: number }[] = [ { 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, }, ]; interface IFolderTileWithThumbnailProps { folderCoverType?: FolderCoverType; originalImageSize?: ISize; size: 'small' | 'large'; item: typeof ITEMS[0]; } const FolderTileWithThumbnail: React.FunctionComponent = ( props: IFolderTileWithThumbnailProps, ): JSX.Element => { const folderCover = ( : null} /> ); const { contentSize } = getFolderCoverLayout(folderCover); const imageSize = props.originalImageSize ? fitContentToBounds({ contentSize: props.originalImageSize, boundsSize: contentSize, mode: 'contain', }) : undefined; return (
}>{props.item.name}} itemActivity={{'12'}}>{props.item.activity}} foreground={ {renderFolderCoverWithLayout(folderCover, { children: imageSize ? ( ) : null, })} } />
); }; export interface ITileFolderExampleState { size: 'small' | 'large'; } export class TileFolderExample extends React.Component<{}, ITileFolderExampleState> { constructor(props: {}) { super(props); this.state = { size: 'large', }; } public render(): JSX.Element { const { size } = this.state; return (

Folder

); } private _onIsLargeChanged = (event: React.FormEvent, checked: boolean): void => { this.setState({ size: checked ? 'large' : 'small', }); }; }