initial ssr visibility toggle

This commit is contained in:
Seth Trowbridge 2023-05-15 22:29:12 -04:00
parent a89dc2c3de
commit 046c3642e6

View File

@ -65,19 +65,15 @@ export const CollapseMenu =(props:{children:React.JSX.Element|React.JSX.Element[
React.useEffect(()=> React.useEffect(()=>
{ {
console.log(`menu animation start:${stateGet.Open}`);
refCollapse.current && refCollapse.current(stateGet.Open, 500, (state, id)=> refCollapse.current && refCollapse.current(stateGet.Open, 500, (state, id)=>
{ {
console.log("menu animation done", state, id);
stateSet({Done:true}); stateSet({Done:true});
} }
); );
}, [stateGet.Open, stateGet.Done]); }, [stateGet.Open, stateGet.Done]);
console.log(`menu re-render: open:${stateGet.Open} done:${stateGet.Done} away:${stateGet.Away}`)
return <div ref={refEl as React.RefObject<HTMLDivElement>}> return <div ref={refEl as React.RefObject<HTMLDivElement>}>
{ props.children} { (stateGet.Done && !stateGet.Open) ? null : props.children}
</div> </div>
}; };
@ -107,8 +103,6 @@ export function Collapser(inElement:HTMLElement, initialState = false)
return function(inOpen?:boolean, inMs?:number, inDone?:DoneCallback) return function(inOpen?:boolean, inMs?:number, inDone?:DoneCallback)
{ {
console.log("collapser sees", inOpen);
cancelAnimationFrame(frameRequest); cancelAnimationFrame(frameRequest);
if(arguments.length) if(arguments.length)