import * as React from 'react'; import { HoverCard, IPlainCardProps, HoverCardType, DetailsList, buildColumns, IColumn, ThemeProvider, Image, ImageFit, getColorFromString, mergeStyles, } from '@fluentui/react'; import { createListItems, IExampleItem } from '@fluentui/example-data'; const itemClass = mergeStyles({ selectors: { '&:hover': { textDecoration: 'underline', cursor: 'pointer', }, }, }); const items: IExampleItem[] = createListItems(10); const buildColumn = (): IColumn[] => { return buildColumns(items).filter( column => column.name === 'color' || column.name === 'width' || column.name === 'height', ); }; const columns: IColumn[] = buildColumn(); const onRenderPlainCard = (item: IExampleItem): JSX.Element => { const src = item.thumbnail + `/${getColorFromString(item.color)!.hex}`; return ; }; const onRenderItemColumn = (item: IExampleItem, index: number, column: IColumn): JSX.Element | React.ReactText => { const plainCardProps: IPlainCardProps = { onRenderPlainCard: onRenderPlainCard, renderData: item, }; if (column.key === 'color') { return (
{item.color}
); } return item[column.key as keyof IExampleItem]; }; export const HoverCardPlainCardExample: React.FunctionComponent = () => { return (

Hover over the color cell of a row item to see the card.

); };