File size: 687 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { useEffect, useRef, useState } from 'react';
import Popover from '.';

export default { title: 'Unaudited/Popover' };

const Container = ( props ) => {
	const [ currentRef, setCurrentRef ] = useState( undefined );
	const ref = useRef( undefined );
	useEffect( () => {
		setCurrentRef( ref.current );
	}, [] );
	return (
		<>
			<div ref={ ref } style={ { display: 'inline-block', border: '1px solid gray' } }>
				Target Element
			</div>
			<Popover
				className="theme-card__tooltip"
				context={ currentRef }
				isVisible
				showDelay={ 0 }
				{ ...props }
			>
				I am the description.
			</Popover>
		</>
	);
};

export const Basic = () => {
	return <Container />;
};