Skip to content

Commit

Permalink
Molstar component
Browse files Browse the repository at this point in the history
  • Loading branch information
samirelanduk committed Aug 1, 2021
1 parent 0634132 commit 14597f2
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/Molstar.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React, { useEffect, useRef } from "react";
import PropTypes from "prop-types";
import { createPluginAsync } from "molstar/lib/mol-plugin-ui/index";
import { DefaultPluginUISpec } from "molstar/lib/mol-plugin-ui/spec";


const Molstar = props => {

const parent = useRef(null);
const plugin = useRef(null);

useEffect(() => {
const defaultSpec = DefaultPluginUISpec();
const init = async () => {
plugin.current = await createPluginAsync(parent.current, {
...defaultSpec,
layout: {
initial: {
isExpanded: false,
showControls: false
},
},
});
}
init();
}, [])

return (
<div
ref={parent}
style={{ width: 640, height: 480, position: "absolute", overflow: "hidden" }}
/>
);
};

Molstar.propTypes = {

};

export default Molstar;
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

import MolstarViewer from "./MolstarViewer.jsx";
import Molstar from "./Molstar.jsx";
export { Molstar };
export default MolstarViewer;

0 comments on commit 14597f2

Please sign in to comment.