right2Other.jsx 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. import React, { PureComponent, useState } from 'react';
  2. import { Tooltip, Button, Popover } from '@douyinfe/semi-ui';
  3. import { PopupContent, Trigger } from './common';
  4. // ❌
  5. const Right2Left = () => {
  6. const [pos, setPos] = useState('right');
  7. return (<div>
  8. <Tooltip
  9. content={
  10. <PopupContent
  11. w={200}
  12. h={200}
  13. />
  14. }
  15. arrowPointAtCenter={false}
  16. visible
  17. trigger='custom'
  18. position={pos}
  19. key={pos}
  20. >
  21. <Trigger
  22. w={100}
  23. h={100}
  24. style={{
  25. position: 'absolute',
  26. right: 0,
  27. bottom: 300
  28. }}
  29. >
  30. pos: {pos}
  31. </Trigger>
  32. </Tooltip>
  33. </div>);
  34. };
  35. // ✅
  36. const Right2LeftTop = () => {
  37. const [pos, setPos] = useState('right');
  38. return (<div>
  39. <Tooltip
  40. content={
  41. <PopupContent
  42. w={200}
  43. h={200}
  44. />
  45. }
  46. arrowPointAtCenter={false}
  47. visible
  48. trigger='custom'
  49. position={pos}
  50. key={pos}
  51. >
  52. <Trigger
  53. w={100}
  54. h={100}
  55. style={{
  56. position: 'absolute',
  57. right: 0,
  58. top: 0
  59. }}
  60. />
  61. </Tooltip>
  62. </div>);
  63. };
  64. // ❌
  65. const Right2LeftBottom = () => {
  66. const [pos, setPos] = useState('right');
  67. return (<div
  68. style={{
  69. }}
  70. >
  71. <Tooltip
  72. content={
  73. <PopupContent
  74. w={200}
  75. h={200}
  76. />
  77. }
  78. arrowPointAtCenter={false}
  79. visible
  80. trigger='custom'
  81. position={pos}
  82. key={pos}
  83. >
  84. <Trigger
  85. w={100}
  86. h={100}
  87. style={{
  88. position: 'absolute',
  89. right: 0,
  90. bottom: 0
  91. }}
  92. />
  93. </Tooltip>
  94. </div>);
  95. };
  96. const Right2RightTop = () => {
  97. const [pos, setPos] = useState('right');
  98. return (<div
  99. style={{
  100. }}
  101. >
  102. <Tooltip
  103. content={
  104. <PopupContent
  105. w={200}
  106. h={200}
  107. />
  108. }
  109. arrowPointAtCenter={false}
  110. visible
  111. trigger='custom'
  112. position={pos}
  113. key={pos}
  114. >
  115. <Trigger
  116. w={100}
  117. h={100}
  118. style={{
  119. position: 'absolute',
  120. top: 40,
  121. }}
  122. />
  123. </Tooltip>
  124. </div>);
  125. };
  126. const Right2RightBottom = () => {
  127. const [pos, setPos] = useState('right');
  128. return (<div
  129. style={{
  130. }}
  131. >
  132. <Tooltip
  133. content={
  134. <PopupContent
  135. w={200}
  136. h={200}
  137. />
  138. }
  139. arrowPointAtCenter={false}
  140. visible
  141. trigger='custom'
  142. position={pos}
  143. key={pos}
  144. >
  145. <Trigger
  146. w={100}
  147. h={100}
  148. style={{
  149. position: 'absolute',
  150. bottom: 0
  151. }}
  152. />
  153. </Tooltip>
  154. </div>);
  155. };
  156. export { Right2Left, Right2LeftTop, Right2LeftBottom, Right2RightTop, Right2RightBottom };