-
-
-
+ const [userURL, setUserURL] = React.useState(manifestURL);
+ const [manifestUrl, setManifestUrl] = React.useState(manifestURL);
+
+ const tabValues = [
+ { title: 'Details', ref: React.useRef(null) },
+ { title: 'Transcripts', ref: React.useRef(null) },
+ { title: 'Files', ref: React.useRef(null) },
+ { title: 'Markers', ref: React.useRef(null) },
+ ];
+
+ React.useEffect(() => {
+ setManifestUrl(manifestUrl);
+ }, [manifestUrl]);
+
+ const handleSubmit = (e) => {
+ e.preventDefault();
+ setManifestUrl(userURL);
+ };
+
+ const handleUserInput = (e) => {
+ setManifestUrl();
+ setUserURL(e.target.value);
+ };
+
+ return (
+
+
+
Ramp
+
An interactive, IIIF powered A/V player built with components
+ from
+ @samvera/ramp
+ library. This player supports IIIF Presentation 3.0 Manifests . Please enter the URL
+ of your public manifest to view it in the player.
+
+
- );
+
+
+
+ );
};
/*Reference: https://accessible-react.eevis.codes/components/tabs */
const Tabs = ({ tabValues, manifestUrl }) => {
- const [activeTab, setActiveTab] = React.useState(0);
-
- let tabs = [];
-
- const handleClick = (index) => {
- setActiveTab(index);
- };
-
- const handleNextTab = (firstTabInRound, nextTab, lastTabInRound) => {
- const tabToSelect =
- activeTab === lastTabInRound ? firstTabInRound : nextTab;
- setActiveTab(tabToSelect);
- tabValues[tabToSelect].ref.current.focus();
- };
-
- const handleKeyPress = (event) => {
- const tabCount = Object.keys(tabValues).length - 1;
-
- if (event.key === "ArrowLeft") {
- const last = tabCount;
- const next = activeTab - 1;
- handleNextTab(last, next, 0);
- }
- if (event.key === "ArrowRight") {
- const first = 0;
- const next = activeTab + 1;
- handleNextTab(first, next, tabCount);
- }
- };
-
- tabValues.map((t, index) => {
- tabs.push(
-
- );
- });
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ const [activeTab, setActiveTab] = React.useState(0);
+
+ let tabs = [];
+
+ const handleClick = (index) => {
+ setActiveTab(index);
+ };
+
+ const handleNextTab = (firstTabInRound, nextTab, lastTabInRound) => {
+ const tabToSelect =
+ activeTab === lastTabInRound ? firstTabInRound : nextTab;
+ setActiveTab(tabToSelect);
+ tabValues[tabToSelect].ref.current.focus();
+ };
+
+ const handleKeyPress = (event) => {
+ const tabCount = Object.keys(tabValues).length - 1;
+
+ if (event.key === "ArrowLeft") {
+ const last = tabCount;
+ const next = activeTab - 1;
+ handleNextTab(last, next, 0);
+ }
+ if (event.key === "ArrowRight") {
+ const first = 0;
+ const next = activeTab + 1;
+ handleNextTab(first, next, tabCount);
+ }
+ };
+
+ tabValues.map((t, index) => {
+ tabs.push(
+
);
+ });
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
};
const Tab = ({ id, tabPanelId, index, handleChange, activeTab, title, tabRef }) => {
- const handleClick = () => { handleChange(index); };
- return (
-
-
- {title}
-
-
- );
+ const handleClick = () => { handleChange(index); };
+ return (
+
+
+ {title}
+
+
+ );
};
const TabPanel = ({ id, tabId, activeTab, tabIndex, children }) => {
- return (
-
- );
+ return (
+
+ );
};
export default App;