/** * Wrapper around Notebook metadata */ import { FontWeights, Icon, IconButton, Link, Persona, PersonaSize, PrimaryButton, Stack, Text } from "office-ui-fabric-react"; import * as React from "react"; import { IGalleryItem } from "../../../Juno/JunoClient"; import { FileSystemUtil } from "../../Notebook/FileSystemUtil"; import "./NotebookViewerComponent.less"; import CosmosDBLogo from "../../../../images/CosmosDB-logo.svg"; import { InfoComponent } from "../NotebookGallery/InfoComponent/InfoComponent"; export interface NotebookMetadataComponentProps { data: IGalleryItem; isFavorite: boolean; downloadButtonText?: string; onTagClick: (tag: string) => void; onFavoriteClick: () => void; onUnfavoriteClick: () => void; onDownloadClick: () => void; onReportAbuseClick: () => void; } export class NotebookMetadataComponent extends React.Component { public render(): JSX.Element { const options: Intl.DateTimeFormatOptions = { year: "numeric", month: "short", day: "numeric" }; const dateString = new Date(this.props.data.created).toLocaleString("default", options); return ( {FileSystemUtil.stripExtension(this.props.data.name, "ipynb")} {this.props.isFavorite !== undefined && ( <> {this.props.data.favorites} likes )} {this.props.downloadButtonText && ( )} <> {dateString} {this.props.data.views} {this.props.data.downloads} {this.props.data.tags?.map((tag, index, array) => ( this.props.onTagClick(tag)}>{tag} {index === array.length - 1 ? <> : ", "} ))} Description {this.props.data.description} ); } }