-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
IconButton: introduce tooltips on icon buttons behind the `unsafeDisa…
…bleTooltip` prop for an incremental rollout (#4224) * IconButton: introduce tooltip behaviuor behind a prop * changeset add * add comment * rename the tooltip prop * rename the prop again 🙃 * remove redundant stories * clean up the mess * test(vrt): update snapshots * toolbar button disable tooltip * icon button as menu anchor & external tooltip & tooltipDirection * update snaps * code review comments * show tooltip only on focus-visible * catch focus-visible for jestdom * rename the prop and update the default version to be true * fix tests * already default true * test(vrt): update snapshots * improve test and example * test(vrt): update snapshots * fix linting * pass the id down and add test --------- Co-authored-by: broccolinisoup <[email protected]> Co-authored-by: Siddharth Kshetrapal <[email protected]>
- Loading branch information
1 parent
8a2486d
commit 8e9267f
Showing
16 changed files
with
325 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@primer/react': minor | ||
--- | ||
|
||
IconButton: introduce tooltips on icon buttons behind the `unsafeDisableTooltip` prop for an incremental rollout. | ||
|
||
In the next release, we plan to update the default value of `unsafeDisableTooltip` to `false` so that the tooltip behaviour becomes the default. |
Binary file modified
BIN
-1 Byte
(100%)
...onents/Dialogv1.test.ts-snapshots/Dialogv1-Default-dark-high-contrast-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,90 @@ | ||
import {HeartIcon} from '@primer/octicons-react' | ||
import {HeartIcon, InboxIcon, ChevronDownIcon} from '@primer/octicons-react' | ||
import React from 'react' | ||
import {IconButton} from '.' | ||
import {ActionMenu} from '../ActionMenu' | ||
import {ActionList} from '../ActionList' | ||
import {Tooltip} from '../TooltipV2' | ||
import {default as TooltipV1} from '../Tooltip' | ||
|
||
export default { | ||
title: 'Components/IconButton/Features', | ||
} | ||
|
||
export const Primary = () => <IconButton icon={HeartIcon} variant="primary" aria-label="Favorite" /> | ||
export const Primary = () => ( | ||
<IconButton icon={HeartIcon} variant="primary" aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Danger = () => <IconButton icon={HeartIcon} variant="danger" aria-label="Favorite" /> | ||
export const Danger = () => ( | ||
<IconButton icon={HeartIcon} variant="danger" aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Invisible = () => <IconButton icon={HeartIcon} variant="invisible" aria-label="Favorite" /> | ||
export const Invisible = () => ( | ||
<IconButton icon={HeartIcon} variant="invisible" aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Disabled = () => <IconButton disabled icon={HeartIcon} aria-label="Favorite" /> | ||
export const Disabled = () => ( | ||
<IconButton disabled icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Small = () => <IconButton size="small" icon={HeartIcon} aria-label="Favorite" /> | ||
export const Small = () => ( | ||
<IconButton size="small" icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Medium = () => <IconButton size="medium" icon={HeartIcon} aria-label="Favorite" /> | ||
export const Medium = () => ( | ||
<IconButton size="medium" icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const Large = () => <IconButton size="large" icon={HeartIcon} aria-label="Favorite" /> | ||
export const Large = () => ( | ||
<IconButton size="large" icon={HeartIcon} aria-label="Favorite" unsafeDisableTooltip={false} /> | ||
) | ||
|
||
export const WithDescription = () => ( | ||
<IconButton | ||
icon={InboxIcon} | ||
aria-label="Notifications" | ||
description="You have no unread notifications." | ||
unsafeDisableTooltip={false} | ||
/> | ||
) | ||
|
||
export const ExternalTooltip = () => ( | ||
<Tooltip text="this is a supportive description for icon button" direction="se"> | ||
<IconButton icon={HeartIcon} aria-label="HeartIcon" /> | ||
</Tooltip> | ||
) | ||
|
||
export const ExternalTooltipVersion1 = () => ( | ||
<TooltipV1 text="this is a supportive description for icon button" direction="se"> | ||
<IconButton icon={HeartIcon} aria-label="HeartIcon" /> | ||
</TooltipV1> | ||
) | ||
|
||
export const AsAMenuAnchor = () => ( | ||
<ActionMenu> | ||
<ActionMenu.Anchor> | ||
<IconButton icon={ChevronDownIcon} aria-label="Something" unsafeDisableTooltip={false} /> | ||
</ActionMenu.Anchor> | ||
|
||
<ActionMenu.Overlay width="medium"> | ||
<ActionList> | ||
<ActionList.Item onSelect={() => alert('Copy link clicked')}> | ||
Copy link | ||
<ActionList.TrailingVisual>⌘C</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
<ActionList.Item onSelect={() => alert('Quote reply clicked')}> | ||
Quote reply | ||
<ActionList.TrailingVisual>⌘Q</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
<ActionList.Item onSelect={() => alert('Edit comment clicked')}> | ||
Edit comment | ||
<ActionList.TrailingVisual>⌘E</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
<ActionList.Divider /> | ||
<ActionList.Item variant="danger" onSelect={() => alert('Delete file clicked')}> | ||
Delete file | ||
<ActionList.TrailingVisual>⌘D</ActionList.TrailingVisual> | ||
</ActionList.Item> | ||
</ActionList> | ||
</ActionMenu.Overlay> | ||
</ActionMenu> | ||
) |
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
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
Oops, something went wrong.