import * as React from 'react'; import { Tile, SignalField, TrendingSignal, CommentsSignal, NewSignal, SharedSignal, ITileBackgroundProps, } from '@uifabric/experiments'; import Screener from 'screener-storybook/src/screener'; import { storiesOf } from '@storybook/react'; import { ISize, fitContentToBounds, Fabric } from 'office-ui-fabric-react'; import { FabricDecorator } from '../utilities'; interface IDocumentItem { name: JSX.Element; activity: JSX.Element; } interface IDocumentTileWithThumbnailProps { originalImageSize: ISize; item: IDocumentItem; } interface IMediaTileWithThumbnailProps { imageSize: ISize; item: IDocumentItem; nameplateOnlyOnHover: boolean; } const DocumentTileBox = (props: { children: React.ReactNode }): JSX.Element => { return (
{props.children}
); }; const MEDIA_TILE_WIDTH = 200; const MEDIA_TILE_HEIGHT = 150; const MediaTileBox = (props: { children: React.ReactNode }): JSX.Element => { return (
{props.children}
); }; const DocumentTileWithThumbnail: React.FunctionComponent = ( props: IDocumentTileWithThumbnailProps, ): JSX.Element => { function renderForeground(foregroundProps: { foregroundSize?: ISize }) { const { foregroundSize = { width: 0, height: 0 } } = foregroundProps; const imageSize = fitContentToBounds({ contentSize: props.originalImageSize, boundsSize: foregroundSize, mode: 'contain', }); return ( ); } return ( }>{props.item.name}} itemActivity={ 12}> {props.item.activity} } foreground={renderForeground} showForegroundFrame={true} /> ); }; const MediaTileWithThumbnail: React.FunctionComponent = ( props: IMediaTileWithThumbnailProps, ): JSX.Element => { const { imageSize, item, nameplateOnlyOnHover } = props; function renderBackground(backgroundProps: ITileBackgroundProps) { return ( ); } return ( ); }; storiesOf('Tile', module) .addDecorator(story => {story()}) .addDecorator(FabricDecorator) .addDecorator(story => // prettier-ignore {story()} , ) .addStory('Document tile with fit landscape image', () => ( Test Name, activity: <>Test Activity, }} originalImageSize={{ width: 200, height: 150, }} /> )) .addStory('Document tile with fit portrait image', () => ( Test Name, activity: <>Test Activity, }} originalImageSize={{ width: 150, height: 200, }} /> )) .addStory('Document tile with icon-sized image', () => ( Test Name, activity: <>Test Activity, }} originalImageSize={{ width: 16, height: 16, }} /> )) .addStory('Document tile with icon', () => ( }>{'Test Name'}} itemActivity={}>{'Test Activity'}} foreground={ } showForegroundFrame={true} /> )) .addStory('Tile with no content and long text', () => ( }>{'This is a name which should overflow'} } itemActivity={ }> {'This is an activity which should overflow'} } showForegroundFrame={false} /> )); storiesOf('MediaTile', module) .addDecorator(story => {story()}) .addDecorator(FabricDecorator) .addDecorator(story => // prettier-ignore {story()} , ) .addStory('Media tile with single activity line', () => ( }>{'Test Name'}, activity: }>{'Test Activity'}, }} imageSize={{ width: MEDIA_TILE_WIDTH, height: MEDIA_TILE_HEIGHT, }} nameplateOnlyOnHover={false} /> )) .addStory('Media tile with two activity lines', () => ( }>{'Test Name'}, activity: ( <> }>{'Test Activity'} {'Test Activity Second Line'} ), }} imageSize={{ width: MEDIA_TILE_WIDTH, height: MEDIA_TILE_HEIGHT, }} nameplateOnlyOnHover={false} /> )) .addStory('Media tile with very long name and activity', () => ( }> {'Lorem ipsum dolor sit amet, consectetur adipiscing elit'} ), activity: ( }> {'Proin elementum erat gravida libero luctus, id consequat risus aliquam'} ), }} imageSize={{ width: MEDIA_TILE_WIDTH, height: MEDIA_TILE_HEIGHT, }} nameplateOnlyOnHover={false} /> )) .addStory('Media tile with nameplate hidden until hover', () => ( }>{'Test Name'}, activity: }>{'Test Activity'}, }} imageSize={{ width: MEDIA_TILE_WIDTH, height: MEDIA_TILE_HEIGHT, }} nameplateOnlyOnHover={true} /> ));