(props: any)
| 49 | } |
| 50 | |
| 51 | export default function Tooltip(props: any) { |
| 52 | const handleConfirm = () => { |
| 53 | props.onConfirm() |
| 54 | } |
| 55 | |
| 56 | const navigateElement = (direction: "parent" | "child" | "prev" | "next") => { |
| 57 | props.onNavigate(direction) |
| 58 | } |
| 59 | |
| 60 | const handleCancel = () => { |
| 61 | props.onCancel() |
| 62 | } |
| 63 | |
| 64 | const setTooltipStyle = () => { |
| 65 | return { ...tooltipStyles.tooltip, left: props.left, top: props.top } |
| 66 | } |
| 67 | |
| 68 | return ( |
| 69 | <div style={setTooltipStyle()} className="codebox-tooltip"> |
| 70 | <button style={tooltipStyles.blueButton} onClick={handleConfirm}> |
| 71 | <CheckOutlined /> 确定 |
| 72 | </button> |
| 73 | <button |
| 74 | style={tooltipStyles.button} |
| 75 | onClick={() => navigateElement("parent")}> |
| 76 | <UpSquareOutlined /> 父节点 |
| 77 | </button> |
| 78 | <button |
| 79 | style={tooltipStyles.button} |
| 80 | onClick={() => navigateElement("child")}> |
| 81 | <DownSquareOutlined /> 子节点 |
| 82 | </button> |
| 83 | <button |
| 84 | style={tooltipStyles.button} |
| 85 | onClick={() => navigateElement("prev")}> |
| 86 | <LeftSquareOutlined /> 上一个 |
| 87 | </button> |
| 88 | <button |
| 89 | style={tooltipStyles.button} |
| 90 | onClick={() => navigateElement("next")}> |
| 91 | <RightSquareOutlined /> 下一个 |
| 92 | </button> |
| 93 | <button style={tooltipStyles.redButton} onClick={handleCancel}> |
| 94 | <CloseOutlined /> 取消 |
| 95 | </button> |
| 96 | </div> |
| 97 | ) |
| 98 | } |
nothing calls this directly
no test coverage detected