Skip to content

Instantly share code, notes, and snippets.

@kdlogan19
Created November 23, 2020 13:43
Show Gist options
  • Save kdlogan19/504b55c1760ec914188eb36755030d66 to your computer and use it in GitHub Desktop.
Save kdlogan19/504b55c1760ec914188eb36755030d66 to your computer and use it in GitHub Desktop.
import React, {
useRef,
useLayoutEffect
} from "react";
import "./styles.css";
import { init } from "universalviewer";
const UV = ({manifest, width = '100vw', height = '100vh'}) => {
const el = useRef();
console.log(el)
useLayoutEffect(() => {
const uv = init(el.current,
{
manifestUri: manifest,
dataLightbox:false,
rotation: 0,
configUri: "/config.json" // This is where I am experiencing issues. */
});
uv.on('created', () => {
uv.resize();
}, false);
}, [manifest]);
return <div ref={el} id="uv" className="uv" style={{
width: width,
height: height,
}} />;
};
export default function App() {
return (
<UV manifest="https://wellcomelibrary.org/iiif/b18035723/manifest" data-lightbox="true" />
);
}
{
"options": {
"dropEnabled": true,
"footerPanelEnabled": false,
"headerPanelEnabled": true,
"leftPanelEnabled": false,
"limitLocales": false,
"overrideFullScreen": false,
"pagingEnabled": true,
"rightPanelEnabled": true
},
"modules": {
"headerPanel": {
"options": {
"localeToggleEnabled": false
}
},
"seadragonCenterPanel": {
"options": {
"autoHideControls": true
}
},
"footerPanel": {
"options":{
"downloadEnabled": false
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment