Skip to content

Commit

Permalink
fix: remove fullWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
daviteixeira-tlf committed Jul 18, 2023
1 parent e9f551f commit 5f516db
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/tooltip.css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,6 @@ export const container = style([
},
]);

export const fullWidth = style({
width: '100%',
});

export const enter = style({
transform: enterTransform,
});
Expand Down
10 changes: 3 additions & 7 deletions src/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {DataAttributes} from './utils/types';
const defaultPositionDesktop = 'bottom';
const defaultPositionMobile = 'top';
const arrowSize = 12;
const minWidth = 40;
const minWidth = 45;
const distanceToTarget = 4 + arrowSize;
const transitionDurationMs = 500;
const animationMovement = 12;
Expand Down Expand Up @@ -106,7 +106,6 @@ type Props = {
targetLabel: string;
delay?: boolean;
dataAttributes?: DataAttributes;
fullWidth?: boolean;
textAlign?: TextAlign;
changedPosition?: string;
};
Expand All @@ -120,7 +119,6 @@ const Tooltip: React.FC<Props> = ({
targetLabel,
delay = true,
dataAttributes,
fullWidth,
changedPosition,
...rest
}) => {
Expand Down Expand Up @@ -311,7 +309,7 @@ const Tooltip: React.FC<Props> = ({
}
const tooltipBoundingClientRect = tooltipRef.current.getBoundingClientRect();

const containerAlign = tooltipBoundingClientRect.width !== minWidth ? 'left' : 'center';
const containerAlign = tooltipBoundingClientRect.width >= minWidth ? 'left' : 'center';

return containerAlign;
};
Expand Down Expand Up @@ -341,13 +339,11 @@ const Tooltip: React.FC<Props> = ({
}
}, [isVisible, getContainerPosition, position, width]);

const targetStyle = fullWidth && styles.fullWidth;

return (
<>
<div
ref={targetRef}
className={classnames(styles.wrapper, targetStyle)}
className={styles.wrapper}
onPointerOver={() => {
if (closeTooltipTimeoutId.current) {
clearTimeout(closeTooltipTimeoutId.current);
Expand Down

0 comments on commit 5f516db

Please sign in to comment.