mirador
Version:
An open-source, web-based 'multi-up' viewer that supports zoom-pan-rotate functionality, ability to display/compare simple images, and images with annotations.
68 lines (60 loc) • 1.83 kB
JSX
import { useId } from 'react';
import PropTypes from 'prop-types';
import Typography from '@mui/material/Typography';
import { useTranslation } from 'react-i18next';
import CollapsibleSection from '../containers/CollapsibleSection';
import SanitizedHtml from '../containers/SanitizedHtml';
import LabelValueMetadata from '../containers/LabelValueMetadata';
import { PluginHook } from './PluginHook';
/**
* ManifestInfo
*/
export function ManifestInfo({
manifestDescription = null,
manifestLabel = null,
manifestMetadata = [],
manifestSummary = null,
...rest
}) {
const { t } = useTranslation();
const id = useId();
const pluginProps = {
manifestDescription,
manifestLabel,
manifestMetadata,
manifestSummary,
...rest,
};
return (
<CollapsibleSection id={`${id}-resource`} label={t('resource')}>
{manifestLabel && (
<Typography
aria-labelledby={`${id}-resource ${id}-resource-heading`}
id={`${id}-resource-heading`}
variant="h4"
component="h5"
>
{manifestLabel}
</Typography>
)}
{manifestDescription && (
<Typography variant="body1">
<SanitizedHtml htmlString={manifestDescription} ruleSet="iiif" />
</Typography>
)}
{manifestSummary && (
<Typography variant="body1">
<SanitizedHtml htmlString={manifestSummary} ruleSet="iiif" />
</Typography>
)}
{manifestMetadata.length > 0 && <LabelValueMetadata labelValuePairs={manifestMetadata} />}
<PluginHook targetName="ManifestInfo" {...pluginProps} />
</CollapsibleSection>
);
}
ManifestInfo.propTypes = {
manifestDescription: PropTypes.string,
manifestLabel: PropTypes.string,
manifestMetadata: PropTypes.array,
manifestSummary: PropTypes.string,
};