Skip to content

Commit

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

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

export const enter = style({
transform: enterTransform,
});
Expand All @@ -158,4 +162,4 @@ export const exit = style({

export const exitActive = style({
animation: `${fadeOutKeyframes} 0.3s ${animationTiming} both`,
});
});
6 changes: 5 additions & 1 deletion src/tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ type Props = {
targetLabel: string;
delay?: boolean;
dataAttributes?: DataAttributes;
fullWidth?: boolean;
textAlign?: TextAlign;
changedPosition?: string;
};
Expand All @@ -119,6 +120,7 @@ const Tooltip: React.FC<Props> = ({
targetLabel,
delay = true,
dataAttributes,
fullWidth,
changedPosition,
...rest
}) => {
Expand Down Expand Up @@ -375,11 +377,13 @@ const Tooltip: React.FC<Props> = ({
}
}, [isVisible, getContainerPosition, position, width]);

const targetStyle = fullWidth && styles.fullWidth;

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

0 comments on commit 87c93f7

Please sign in to comment.