import { css } from '@patternfly/react-styles'; import styles from '../../../css/topology-components'; import Point from '../../../geom/Point'; import { ConnectDragSource } from '../../../behavior/dnd-types'; import { getConnectorRotationAngle, getConnectorStartPoint } from './terminalUtils'; interface ConnectorSquareProps { startPoint: Point; endPoint: Point; className?: string; isTarget?: boolean; size?: number; dragRef?: ConnectDragSource; } const ConnectorSquare: React.FunctionComponent = ({ startPoint, endPoint, className = '', isTarget = true, size = 14, dragRef }) => { if (!startPoint || !endPoint) { return null; } const connectorStartPoint = getConnectorStartPoint(startPoint, endPoint, size); const angleDeg = getConnectorRotationAngle(startPoint, endPoint); const classNames = css( styles.topologyConnectorArrow, styles.topologyConnectorSquare, !isTarget && styles.modifiers.source, className, dragRef && 'pf-m-draggable' ); return ( ); }; export default ConnectorSquare;