@@ -11,36 +11,12 @@ specifically, or roll your own like the below example.
1111``` js live
1212import { Modal , Overlay } from " @restart/ui" ;
1313import Transition from " react-transition-group/Transition" ;
14+ import Button from " ../src/Button" ;
15+ import Tooltip from " ../src/Tooltip" ;
16+ import ' ../src/css/transitions.css' ;
1417
1518const FADE_DURATION = 200 ;
1619
17- injectCss (`
18- .fade {
19- opacity: 0;
20- transition: opacity ${ FADE_DURATION } ms linear;
21- }
22-
23- .show {
24- opacity: 1;
25- }
26-
27-
28- .backdrop.fade.show {
29- opacity: 0.5;
30- }
31-
32- .dialog {
33- position: absolute;
34- width: 400;
35- top: 50%; left: 50%;
36- transform: translate(-50%, -50%);
37- border: 1px solid #e5e5e5;
38- background-color: white;
39- box-shadow: 0 5px 15px rgba(0, 0, 0, .5);
40- padding: 20px;
41- }
42- ` );
43-
4420const fadeStyles = {
4521 entering: " show" ,
4622 entered: " show" ,
@@ -60,32 +36,33 @@ const Fade = ({ children, ...props }) => (
6036function TransitionExample () {
6137 const [showModal , setShowModal ] = useState (false );
6238 const [showTooltip , setShowTooltip ] = useState (false );
63- const [tooltipRef , attachRef ] = useState (null );
39+
40+ const triggerRef = useRef (null );
6441
6542 return (
6643 < div className= " flex flex-col items-center" >
67- < button
44+ < Button
6845 type= " button"
6946 className= " btn btn-primary mr-3"
7047 onClick= {() => setShowModal ((prev ) => ! prev)}
7148 >
7249 Show Animated Modal
73- < / button >
50+ < / Button >
7451
75- < button
52+ < Button
7653 type= " button"
7754 className= " btn btn-primary"
7855 onClick= {() => setShowTooltip ((prev ) => ! prev)}
79- ref= {attachRef }
56+ ref= {triggerRef }
8057 >
8158 Show Tooltip
82- < / button >
59+ < / Button >
8360
8461 < Overlay
8562 placement= " top"
8663 transition= {Fade}
8764 show= {showTooltip}
88- target= {tooltipRef }
65+ target= {triggerRef }
8966 popperConfig= {{
9067 modifiers: [
9168 {
@@ -96,14 +73,10 @@ function TransitionExample() {
9673 ],
9774 }}
9875 >
99- {({ props: { ref, style } }) => (
100- < div
101- ref= {ref}
102- className= " bg-primary-200 shadow rounded z-10 px-4"
103- style= {style}
104- >
105- Hello there
106- < / div>
76+ {(props , { arrowProps, popper, show }) => (
77+ < Tooltip {... props} arrowProps= {arrowProps} popper= {popper}>
78+ Tooltip content
79+ < / Tooltip>
10780 )}
10881 < / Overlay>
10982
@@ -123,7 +96,7 @@ function TransitionExample() {
12396 {... props}
12497 className= " fixed inset-0 z-50 flex items-center justify-center pointer-events-none"
12598 >
126- < div className= " dialog bg-white shadow rounded-lg pointer-events-auto" >
99+ < div className= " dialog dialog-transitions-example bg-white shadow rounded-lg pointer-events-auto" >
127100 < h4 id= " modal-label" > I & apos;m fading in ! < / h4>
128101 < p>
129102 Anim pariatur cliche reprehenderit, enim
0 commit comments