Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot committed Jan 11, 2024
1 parent f6312be commit 70ca9bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 13 additions & 12 deletions packages/victory-tooltip/src/flyout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
UserProps,
VictoryCommonPrimitiveProps,
OrientationTypes,
NumberOrCallback,
} from "victory-core";
import { isPlainObject, assign } from "lodash";

// TODO: this needs to be typed to FlyoutProps
const getVerticalPath = (props) => {
const { pointerWidth, cornerRadius, orientation, width, height, center } =
props;
const sign = orientation === "bottom" ? 1 : -1;
const x = props.x || 0 + (props.dx || 0);
const y = props.y || 0 + (props.dy || 0);
const x = props.x + (props.dx || 0);
const y = props.y + (props.dy || 0);
const centerX = isPlainObject(center) && center.x;
const centerY = isPlainObject(center) && center.y;
const pointerEdge = centerY + sign * (height / 2);
Expand All @@ -41,6 +41,7 @@ const getVerticalPath = (props) => {
z`;
};

// TODO: this needs to be typed to FlyoutProps
const getHorizontalPath = (props) => {
const { pointerWidth, cornerRadius, orientation, width, height, center } =
props;
Expand Down Expand Up @@ -99,19 +100,19 @@ const defaultProps = {

export interface FlyoutProps extends VictoryCommonPrimitiveProps {
center?: {
x?: number | null;
y?: number | null;
x?: number;
y?: number;
};
cornerRadius?: NumberOrCallback;
cornerRadius?: number;
datum?: object;
dx?: NumberOrCallback;
dy?: NumberOrCallback;
height?: NumberOrCallback;
dx?: number;
dy?: number;
height?: number;
orientation?: OrientationTypes;
pathComponent?: React.ReactElement;
pointerLength?: NumberOrCallback;
pointerWidth?: NumberOrCallback;
width?: NumberOrCallback;
pointerLength?: number;
pointerWidth?: number;
width?: number;
x?: number;
y?: number;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/victory-tooltip/src/victory-tooltip.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { VictoryContainer, VictoryLabel } from "victory-core";
import { fireEvent, screen, render } from "@testing-library/react";

import Flyout from "./flyout";
import { VictoryTooltip, VictoryTooltipProps } from "victory-tooltip";
import { VictoryTooltip, VictoryTooltipProps } from "./victory-tooltip";

describe("components/victory-tooltip", () => {
const flyoutId = "flyout-1";
Expand Down

0 comments on commit 70ca9bd

Please sign in to comment.