Skip to content
Snippets Groups Projects
Select Git revision
  • aafcef5dc0203be27e24414b70adf00d11a7bdfe
  • main default
  • 35-cgu
  • 34-peertube-support
  • 27-add-autoplay-to-iframe
  • 33-bug-on-youtube-embed-urls
  • RC-Rekall-v1.1-fix_lpo
  • tuleap-140-go-back-to-my-capsules-page-when-i-m-on-capsule-preview-page
  • RC-Rekall-v1.2-fix10
  • RC-Rekall-v1.2-fix9
  • RC-Rekall-v1.2-fix8
  • RC-Rekall-v1.2-fix7
  • RC-Rekall-v1.2-fix6
  • RC-Rekall-v1.2-fix5
  • RC-Rekall-v1.2-fix4
  • RC-Rekall-v1.2-fix3
  • RC-Rekall-v1.2-fix2
  • RC-Rekall-v1.2-fix1
  • RC-Rekall-v1.1-fix-3
  • RC-Rekall-v1.1-fix-2
  • RC-Rekall-v1.1-fix-1
  • RC-Rekall-v1.1-delivered
  • preprod20220209-1535
23 results

phpcs.xml.dist

Blame
  • CanvasInfo.js 1.93 KiB
    import React, { Component } from 'react';
    import PropTypes from 'prop-types';
    import Typography from '@material-ui/core/Typography';
    import CollapsibleSection from '../containers/CollapsibleSection';
    import SanitizedHtml from '../containers/SanitizedHtml';
    import { LabelValueMetadata } from './LabelValueMetadata';
    import { PluginHook } from './PluginHook';
    
    /**
     * CanvasInfo
     */
    export class CanvasInfo extends Component {
      /**
       * render
       * @return
       */
      render() {
        const {
          canvasDescription,
          canvasLabel,
          canvasMetadata,
          id,
          index,
          t,
          totalSize,
        } = this.props;
    
        return (
          <CollapsibleSection
            id={`${id}-currentItem-${index}`}
            label={t('currentItem', { context: `${index + 1}/${totalSize}` })}
          >
            {canvasLabel && (
              <Typography
                aria-labelledby={
                  `${id}-currentItem-${index} ${id}-currentItem-${index}-heading`
                }
                id={`${id}-currentItem-${index}-heading`}
                variant="h4"
                component="h5"
              >
                {canvasLabel}
              </Typography>
            )}
    
            {canvasDescription && (
              <Typography variant="body1">
                <SanitizedHtml htmlString={canvasDescription} ruleSet="iiif" />
              </Typography>
            )}
    
            {canvasMetadata && canvasMetadata.length > 0 && (
              <LabelValueMetadata labelValuePairs={canvasMetadata} />
            )}
            <PluginHook {...this.props} />
          </CollapsibleSection>
        );
      }
    }
    
    CanvasInfo.propTypes = {
      canvasDescription: PropTypes.string,
      canvasLabel: PropTypes.string,
      canvasMetadata: PropTypes.array, // eslint-disable-line react/forbid-prop-types
      id: PropTypes.string.isRequired,
      index: PropTypes.number,
      t: PropTypes.func,
      totalSize: PropTypes.number,
    };
    
    CanvasInfo.defaultProps = {
      canvasDescription: null,
      canvasLabel: null,
      canvasMetadata: [],
      index: 1,
      t: key => key,
      totalSize: 1,
    };