-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1761 from Shopify/passanelli/fix_tooltip_position…
…_grid fix, Tooltip should be render inside `polaris_viz_tooltip_root`
- Loading branch information
Showing
9 changed files
with
165 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/polaris-viz/src/components/Grid/stories/playground/ExternalTooltip.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import type {Story} from '@storybook/react'; | ||
|
||
import {Grid} from '../../Grid'; | ||
import type {GridProps} from '../../Grid'; | ||
import {CELL_GROUPS} from '../data'; | ||
import {META} from '../meta'; | ||
|
||
export default { | ||
...META, | ||
title: `${META.title}/Playground`, | ||
decorators: [], | ||
}; | ||
|
||
function GridCard(args: GridProps) { | ||
return ( | ||
<div | ||
style={{ | ||
height: 400, | ||
width: 800, | ||
background: 'white', | ||
borderRadius: '8px', | ||
padding: 10, | ||
}} | ||
> | ||
<Grid {...args} /> | ||
</div> | ||
); | ||
} | ||
|
||
const Template: Story<GridProps> = (args: GridProps) => { | ||
return ( | ||
<div style={{display: 'flex', gap: '20px'}}> | ||
<GridCard {...args} /> | ||
<GridCard {...args} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export const MultipleGridsTooltipPosition = Template.bind({}); | ||
|
||
MultipleGridsTooltipPosition.args = { | ||
cellGroups: CELL_GROUPS, | ||
xAxisOptions: { | ||
label: 'Recency', | ||
}, | ||
yAxisOptions: { | ||
label: 'Frequency', | ||
}, | ||
}; |
62 changes: 62 additions & 0 deletions
62
packages/polaris-viz/src/components/Grid/stories/playground/TooltipOverflow.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import type {Story} from '@storybook/react'; | ||
|
||
import {Grid} from '../../Grid'; | ||
import type {GridProps} from '../../Grid'; | ||
import {CELL_GROUPS} from '../data'; | ||
import {META} from '../meta'; | ||
|
||
export default { | ||
...META, | ||
title: `${META.title}/Playground`, | ||
decorators: [], | ||
}; | ||
|
||
function GridCard(args: GridProps) { | ||
return ( | ||
<div | ||
style={{ | ||
height: 400, | ||
width: 800, | ||
background: 'white', | ||
border: '1px solid #e0e0e0', | ||
borderRadius: '8px', | ||
padding: 10, | ||
overflow: 'hidden', | ||
position: 'relative', | ||
}} | ||
> | ||
<Grid {...args} /> | ||
</div> | ||
); | ||
} | ||
|
||
const Template: Story<GridProps> = (args: GridProps) => { | ||
return ( | ||
<div style={{padding: '50px'}}> | ||
<div style={{display: 'flex', gap: '20px'}}> | ||
<GridCard {...args} /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const TooltipOverflow = Template.bind({}); | ||
|
||
TooltipOverflow.args = { | ||
cellGroups: CELL_GROUPS, | ||
xAxisOptions: { | ||
label: 'Recency', | ||
}, | ||
yAxisOptions: { | ||
label: 'Frequency', | ||
}, | ||
}; | ||
|
||
TooltipOverflow.parameters = { | ||
docs: { | ||
description: { | ||
story: | ||
'This story tests that tooltips render correctly when the Grid is inside a container with overflow: hidden.', | ||
}, | ||
}, | ||
}; |
3 changes: 1 addition & 2 deletions
3
packages/polaris-viz/src/components/Grid/utilities/constants.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters