From 85306c26ad9f7f21c8237f009d533ee69a256541 Mon Sep 17 00:00:00 2001 From: Sylvester Keil Date: Fri, 19 Jul 2019 23:01:58 +0200 Subject: [PATCH] Add MetadataField component Print photo metadata (wip) --- src/components/print/metadata.js | 49 +++++++++++++ src/components/print/photo.js | 120 +++++-------------------------- 2 files changed, 68 insertions(+), 101 deletions(-) create mode 100644 src/components/print/metadata.js diff --git a/src/components/print/metadata.js b/src/components/print/metadata.js new file mode 100644 index 000000000..a1144f272 --- /dev/null +++ b/src/components/print/metadata.js @@ -0,0 +1,49 @@ +'use strict' + +const React = require('react') +const cx = require('classnames') + +const { + arrayOf, + bool, + object, + string +} = require('prop-types') + + +const MetadataField = ({ isExtra, label, value }) => ( +
  • + +
    {value}
    +
  • +) + +MetadataField.propTypes = { + isExtra: bool, + label: string.isRequired, + value: string +} + +const MetadataSection = ({ fields, title }) => ( +
    +
    {title}
    +
      + {fields.map((f, idx) => + )} +
    +
    +) + +MetadataSection.propTypes = { + fields: arrayOf(object), + title: string.isRequired +} + +module.exports = { + MetadataField, + MetadataSection +} diff --git a/src/components/print/photo.js b/src/components/print/photo.js index d15519c3b..45a728f85 100644 --- a/src/components/print/photo.js +++ b/src/components/print/photo.js @@ -1,11 +1,20 @@ 'use strict' const React = require('react') +const { MetadataSection } = require('./metadata') const cx = require('classnames') const { Rotation } = require('../../common/iiif') -const { bool, number, string } = require('prop-types') -const Photo = ({ angle, height, mirror, orientation, path, width }) => { +const { + arrayOf, + bool, + number, + object, + string +} = require('prop-types') + + +const Photo = ({ angle, data, height, mirror, orientation, path, width }) => { let rotation = Rotation .fromExifOrientation(orientation) .add({ angle, mirror }) @@ -17,112 +26,21 @@ const Photo = ({ angle, height, mirror, orientation, path, width }) => { className={`iiif rot-${rotation.format('x')}`} src={path}/> -
    -
    -
    -
    Item
    -
      -
    1. - -
      Cathcart to Eaton
      -
    2. -
    3. - -
      Cathcart, James Leander
      -
    4. -
    5. - -
      Eaton, William
      -
    6. -
    7. - -
      Oct 11, 1800
      -
    8. -
    9. - -
      Tripoli
      -
    10. -
    11. - -
      Correspondence
      -
    12. -
    13. - -
      Library of Congress
      -
    14. -
    15. - -
      James L. Cathcart papers, 1785–1817
      -
    16. -
    17. - -
      -
    18. -
    19. - -
      Cathcart Letterbook
      -
    20. -
    21. - -
      MSS15388
      -
    22. -
    23. - -
      public domain
      -
    24. -
    25. - -
      http://hdl.loc.gov/loc.mss/eadmss.ms009015
      -
    26. -
    27. - -
      Sep 19, 2017, 9:41 AM
      -
    28. -
    29. - -
      Feb 7, 2019, 12:50 PM
      -
    30. -
    -
    -
    -
    -
    -
    Photo
    -
      -
    1. - -
      IMG_1716
      -
    2. -
    3. - -
      Aug 13, 2018, 12:57 PM
      -
    4. -
    5. - -
      IMG_1716.jpg
      -
    6. -
    7. - -
      4,032×3,024, 1.74MB
      -
    8. -
    9. - -
      Mar 11, 2019, 12:50 PM
      -
    10. -
    11. - -
      Mar 18, 2019, 7:22 PM
      -
    12. -
    -
    -
    +
    +
    +
    +
    + +
    +
    ) } Photo.propTypes = { angle: number.isRequired, + data: arrayOf(object).isRequired, height: number.isRequired, mirror: bool.isRequired, orientation: number.isRequired,