diff --git a/src/components/Menu.tsx b/src/components/Menu.tsx index 14bba20..16adff2 100644 --- a/src/components/Menu.tsx +++ b/src/components/Menu.tsx @@ -29,9 +29,9 @@ const useStyles = makeStyles({ }, }); -function Menu() { +function Menu(props: { open?: boolean }) { const sourceAtoms = useAtomValue(sourceInfoAtomAtoms); - const [hidden, toggle] = useReducer((v) => !v, false); + const [hidden, toggle] = useReducer((v) => !v, !(props.open ?? true)); const classes = useStyles(); return (
diff --git a/src/index.tsx b/src/index.tsx index 1193500..a51e143 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -26,7 +26,7 @@ export interface VizarrViewer { destroy(): void; } -export function createViewer(element: HTMLElement): Promise { +export function createViewer(element: HTMLElement, options: { menuOpen?: boolean } = {}): Promise { const ref = React.createRef(); const emitter = typedEmitter(); const viewStateAtom = atomWithEffect( @@ -55,7 +55,7 @@ export function createViewer(element: HTMLElement): Promise { }, []); return ( <> - + );