@macrostrat/column-components
Version:
React rendering primitives for stratigraphic columns
54 lines (48 loc) • 2.35 kB
JavaScript
import {createContext as $jPNVd$createContext, useContext as $jPNVd$useContext, useEffect as $jPNVd$useEffect} from "react";
import $jPNVd$macrostrathyper from "@macrostrat/hyper";
// Default value for computePhotoPath
const $bc8fa037699cae1b$var$passThrough = (src)=>src;
const $bc8fa037699cae1b$export$9f4be09e3914797a = (0, $jPNVd$createContext)({
photos: null,
computePhotoPath: $bc8fa037699cae1b$var$passThrough
});
function $bc8fa037699cae1b$export$77971d5b6cbacaf9(props) {
const { children: children, computePhotoPath: computePhotoPath = $bc8fa037699cae1b$var$passThrough, photos: photos } = props;
return (0, $jPNVd$macrostrathyper)($bc8fa037699cae1b$export$9f4be09e3914797a.Provider, {
value: {
photos: photos,
computePhotoPath: computePhotoPath
},
children: children
});
}
function $bc8fa037699cae1b$export$24f17aabaa7629ce(props) {
const { photos: photos, computePhotoPath: computePhotoPath } = (0, $jPNVd$useContext)($bc8fa037699cae1b$export$9f4be09e3914797a);
if (photos == null) return null;
const { photoIDs: photoIDs, ...rest } = props;
const displayedPhotos = photoIDs.map((id)=>{
return photos.find((d)=>d.id === id);
});
const getPaths = function(d) {
const src = computePhotoPath(d);
return {
src: src,
caption: d.note
};
};
const images = displayedPhotos.filter((d)=>d != null).map(getPaths);
return (0, $jPNVd$macrostrathyper)($bc8fa037699cae1b$var$PhotoGallery, {
images: images,
...rest
});
}
const $bc8fa037699cae1b$var$PhotoGallery = function({ images: images, isOpen: isOpen = false, onClose: onClose }) {
/** The photo gallery component has been removed due to an outdated design.
* Please use another library for this functionality.
*/ (0, $jPNVd$useEffect)(()=>{
console.error("PhotoOverlay from @macrostrat/column-components has been disabled due to an outdated design. Please use another library for this functionality.");
}, []);
return null;
};
export {$bc8fa037699cae1b$export$9f4be09e3914797a as PhotoLibraryContext, $bc8fa037699cae1b$export$77971d5b6cbacaf9 as PhotoLibraryProvider, $bc8fa037699cae1b$export$24f17aabaa7629ce as PhotoOverlay};
//# sourceMappingURL=column-components.42716b98.js.map