Skip to content

Commit

Permalink
fix: add tooltip length (pinterest#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
jczhong84 authored and rohan-sh1 committed Apr 11, 2023
1 parent cd61615 commit fd972a0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export const DataTableHeader: React.FunctionComponent<IDataTableHeader> = ({
weight="bold"
color="lightest"
tooltip={ownerType.description}
tooltipPos="right"
>
{ownerType.display_name}
</AccentText>
Expand Down
8 changes: 8 additions & 0 deletions querybook/webapp/const/tooltip.ts
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
export type TooltipDirection = 'up' | 'down' | 'left' | 'right';
// By default, tooltips will be single-line no matter their length.
export type TooltipLength =
| 'small'
| 'medium'
| 'medium'
| 'xlarge'
| 'fit'
| undefined;
6 changes: 4 additions & 2 deletions querybook/webapp/ui/Tag/Tag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React from 'react';
import styled from 'styled-components';

import { ColorPalette } from 'const/chartColors';
import { TooltipDirection } from 'const/tooltip';
import { TooltipDirection, TooltipLength } from 'const/tooltip';

import './Tag.scss';

Expand Down Expand Up @@ -33,10 +33,12 @@ export interface ITagProps {
export const TagGroup = styled.div.attrs<{
tooltip?: string;
tooltipPos?: TooltipDirection;
tooltipLength?: TooltipLength;
className?: string;
}>(({ tooltip, tooltipPos, className }) => ({
}>(({ tooltip, tooltipPos, tooltipLength = 'large', className }) => ({
'aria-label': tooltip,
'data-balloon-pos': tooltipPos,
'data-balloon-length': tooltipLength,
className: `${className} TagGroup`,
}))``;

Expand Down

0 comments on commit fd972a0

Please sign in to comment.