import React from 'react'; import filesize from 'filesize' import * as timeago from 'timeago.js'; import PropTypes from 'prop-types'; /** * ResourceInfo component displays all resources in a data package * @param {Array} resources A Frictionless datapackage resource object * @returns React Component */ const ResourcesInfo = ({ resources }) => { return ( <>

File

Description

Size

Created

Updated

Download

{resources.map((resource, index) => { return (

{resource.title || resource.name}

{resource.description || "No description"}

{resource.size ? filesize(resource.size, { bits: true }) : 0}

{resource.created && timeago.format(resource.created)}

{resource.updated && timeago.format(resource.updated)}

{/* We assume that resource.path is a URL but not relative path. */} {resource.format}

) })}
) } ResourcesInfo.propTypes = { resources: PropTypes.array.isRequired } export default ResourcesInfo