diff --git a/src/molviewer--ligandviewer.stories.tsx b/src/molviewer--ligandviewer.stories.tsx new file mode 100644 index 0000000..4351f7f --- /dev/null +++ b/src/molviewer--ligandviewer.stories.tsx @@ -0,0 +1,40 @@ +import { Story, action } from "@ladle/react"; + +import { useEffect, useState } from "react"; +import { LigandViewer } from "./molviewer"; + +export const Default: Story<{ + code: string; + chain: string; + resno: number; +}> = ({ code, chain, resno }) => { + const [structure, setStructure] = useState(undefined); + useEffect(() => { + fetch(`https://files.rcsb.org/download/${code}.pdb`) + .then((response) => response.blob()) + .then((blob) => + setStructure( + new File([blob], `${code}.pdb`, { type: "chemical/x-pdb" }), + ), + ); + }, [code]); + if (!structure) return null; + return ( + + ); +}; +Default.args = { + code: "2YA8", + chain: "B", + resno: 1777, +}; diff --git a/src/molviewer--simpleviewer.stories.tsx b/src/molviewer--simpleviewer.stories.tsx index a8a81a2..9055437 100644 --- a/src/molviewer--simpleviewer.stories.tsx +++ b/src/molviewer--simpleviewer.stories.tsx @@ -3,6 +3,4 @@ import { Story } from "@ladle/react"; import { SimpleViewer } from "./molviewer"; import { structure } from "./structure"; -// TODO make dark mode aware - export const Default: Story = () => ; diff --git a/src/molviewer--viewer.stories.tsx b/src/molviewer--viewer.stories.tsx new file mode 100644 index 0000000..5a3c3d7 --- /dev/null +++ b/src/molviewer--viewer.stories.tsx @@ -0,0 +1,29 @@ +import { Story } from "@ladle/react"; +import { Viewer } from "./molviewer"; +import { structure } from "./structure"; + +export const Default: Story = () => { + return ( + + ); +}; + +export const BallStick: Story = () => { + return ( + + ); +};