UNPKG

@macrostrat/column-components

Version:

React rendering primitives for stratigraphic columns

3 lines (2 loc) 1.07 kB
import{createContext as o,useContext as t,useEffect as e}from"react";import r from"@macrostrat/hyper";function a(o,t,e,r){Object.defineProperty(o,t,{get:e,set:r,enumerable:!0,configurable:!0})}var n={};a(n,"PhotoLibraryContext",()=>l),a(n,"PhotoLibraryProvider",()=>c),a(n,"PhotoOverlay",()=>s);let i=o=>o,l=o({photos:null,computePhotoPath:i});function c(o){let{children:t,computePhotoPath:e=i,photos:a}=o;return r(l.Provider,{value:{photos:a,computePhotoPath:e},children:t})}function s(o){let{photos:e,computePhotoPath:a}=t(l);if(null==e)return null;let{photoIDs:n,...i}=o;return r(u,{images:n.map(o=>e.find(t=>t.id===o)).filter(o=>null!=o).map(function(o){return{src:a(o),caption:o.note}}),...i})}let u=function({images:o,isOpen:t=!1,onClose:r}){return e(()=>{console.error("PhotoOverlay from @macrostrat/column-components has been disabled due to an outdated design. Please use another library for this functionality.")},[]),null};export{l as PhotoLibraryContext,c as PhotoLibraryProvider,s as PhotoOverlay}; //# sourceMappingURL=column-components.177e6187.js.map