import * as React from 'react'; import { Layer, TetherBehavior, TETHER_PLACEMENT, } from 'baseui/layer'; import {useStyletron} from 'baseui'; import {Button} from 'baseui/button'; function Wrapper(props: any) { const [css] = useStyletron(); const {offset, color, children, forwardedRef} = props; return (
{children}
); } const initialState = { isFirstOpen: false, isSecondOpen: false, isFirstMounted: false, isSecondMounted: false, offset1: {top: 0, left: 0}, offset2: {top: 0, left: 0}, }; export default class BasicTether extends React.Component< {}, typeof initialState > { anchorRef1: any = React.createRef(); popperRef1: any = React.createRef(); anchorRef2: any = React.createRef(); popperRef2: any = React.createRef(); state = initialState; onPopperUpdate: any = (order: string, normalizedOffsets: any) => { this.setState({ [`offset${order}`]: normalizedOffsets.popper, } as any); }; render() { return ( {this.state.isFirstOpen ? ( this.setState({isFirstMounted: true})} onUnmount={() => this.setState({isFirstMounted: false})} > this.onPopperUpdate(1, ...args) } placement={TETHER_PLACEMENT.right} > ) : null}

{this.state.isSecondOpen ? ( this.setState({isSecondMounted: true})} onUnmount={() => this.setState({isSecondMounted: false}) } > this.onPopperUpdate(2, ...args) } placement={TETHER_PLACEMENT.right} > ) : null}
); } }