Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/gamut/src/Tip/shared/FloatingTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const FloatingTip: React.FC<TipWrapperProps> = ({

const commonPopoverProps = getPopoverAlignmentAndPattern({ alignment, type });
const dims = getAlignmentStyles({ avatar, alignment, type });
const isHorizontalCenter = dims === 'horizontalCenter';
const [childRef, { width: tipWidth }] = useMeasure<HTMLDivElement>();

const [offset, setOffset] = useState<number | undefined>(undefined);
Expand Down Expand Up @@ -169,8 +170,9 @@ export const FloatingTip: React.FC<TipWrapperProps> = ({
widthRestricted={false}
>
<FloatingTipTextWrapper
horizNarrow={narrow && isHorizontalCenter}
isHoverType={isHoverType}
narrow={narrow}
narrow={narrow && !isHorizontalCenter}
ref={childRef}
>
{contents}
Expand Down
4 changes: 3 additions & 1 deletion packages/gamut/src/Tip/shared/InlineTip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export const InlineTip: React.FC<TipWrapperProps> = ({
const inlineWrapperProps = isHoverType ? {} : { hideTip: isTipHidden };
const tipWrapperProps = isHoverType ? ({ inheritDims } as const) : {};
const tipBodyAlignment = getAlignmentStyles({ alignment, avatar, type });
const isHorizontalCenter = tipBodyAlignment === 'horizontalCenter';

const target = (
<TargetContainer
Expand All @@ -63,8 +64,9 @@ export const InlineTip: React.FC<TipWrapperProps> = ({
aria-hidden={isHoverType}
color="currentColor"
id={id}
maxWidth={narrow && isHorizontalCenter ? '64px' : undefined}
role={type === 'tool' ? 'tooltip' : undefined}
width={narrow ? narrowWidth : 'max-content'}
width={narrow && !isHorizontalCenter ? narrowWidth : 'max-content'}
zIndex="auto"
>
{type === 'preview' ? (
Expand Down
1 change: 1 addition & 0 deletions packages/gamut/src/Tip/shared/elements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const tipWrapperStyles = {
const floatingTipTextStates = states({
isHoverType: { alignItems: 'flexStart' },
narrow: { width: narrowWidth },
horizNarrow: { maxWidth: narrowWidth },
});

const inlineTipStates = states({
Expand Down