Skip to content

Commit

Permalink
revert action label styling to default, adds isIconExternal prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jenny-s51 committed Mar 8, 2024
1 parent 94178dd commit d85fc13
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/module/src/components/nodes/labels/LabelActionIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ interface LabelActionIconProps {
}

const LabelActionIcon = React.forwardRef<SVGRectElement, LabelActionIconProps>(
({ icon, isIconExternal, onClick, className, x, y, paddingX, height}) => {
({ icon, isIconExternal, onClick, className, x, y, paddingX, height, iconOffsetX = 0, iconOffsetY = 0 }) => {
const [iconSize, iconRef] = useSize([icon, paddingX]);
const iconWidth = iconSize?.width ?? 0;
const iconHeight = iconSize?.height ?? 0;
// const [hovered, hoverRef] = useHover();

const iconHeight = iconSize?.height ?? 0;
const iconY = (height - iconHeight) / 2;

const centerX = x + height / 2 - iconWidth / 2;
const centerY = y + height / 2 - iconHeight / 2;
Expand All @@ -46,13 +45,13 @@ const LabelActionIcon = React.forwardRef<SVGRectElement, LabelActionIconProps>(
className={isIconExternal ? css(pipelineStyles.topologyPipelinesNodeActionIconBackground) : css(styles.topologyNodeActionIconBackground)}
x={x}
y={y}
width={height}
width={isIconExternal ? height :iconWidth + paddingX * 2}
height={height}
/>
)}
<g
className={isIconExternal ? css(pipelineStyles.topologyPipelinesNodeActionIconIcon) : css(styles.topologyNodeActionIconIcon)}
transform={`translate(${centerX}, ${centerY})`}
transform={isIconExternal ? `translate(${centerX}, ${centerY})` : `translate(${x + paddingX + iconOffsetX}, ${y + iconY + iconOffsetY})`}
ref={iconRef}
>
{icon}
Expand Down

0 comments on commit d85fc13

Please sign in to comment.