Skip to content

Commit

Permalink
Add tooltips to shortcuts
Browse files Browse the repository at this point in the history
Signed-off-by: Philipp Hugenroth <philipph@spotify.com>
  • Loading branch information
tudi2d committed Nov 17, 2021
1 parent d701630 commit f93e56a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/sweet-suits-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/plugin-shortcuts': patch
---

Add tooltip to display shortcut title on hover. This should improve the readability of shortcuts with long names, which are cutoff by ellipsis.
34 changes: 19 additions & 15 deletions plugins/shortcuts/src/ShortcutItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
*/

import React from 'react';
import { IconButton, makeStyles } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import IconButton from '@material-ui/core/IconButton';
import Tooltip from '@material-ui/core/Tooltip';
import EditIcon from '@material-ui/icons/Edit';
import { ShortcutIcon } from './ShortcutIcon';
import { EditShortcut } from './EditShortcut';
Expand Down Expand Up @@ -76,21 +78,23 @@ export const ShortcutItem = ({ shortcut, api }: Props) => {

return (
<>
<SidebarItem
className={classes.root}
to={shortcut.url}
text={shortcut.title}
icon={() => <ShortcutIcon text={text} color={color} />}
>
<IconButton
id="edit"
data-testid="edit"
onClick={handleClick}
className={classes.button}
<Tooltip title={shortcut.title} enterDelay={500}>
<SidebarItem
className={classes.root}
to={shortcut.url}
text={shortcut.title}
icon={() => <ShortcutIcon text={text} color={color} />}
>
<EditIcon className={classes.icon} />
</IconButton>
</SidebarItem>
<IconButton
id="edit"
data-testid="edit"
onClick={handleClick}
className={classes.button}
>
<EditIcon className={classes.icon} />
</IconButton>
</SidebarItem>
</Tooltip>
<EditShortcut
onClose={handleClose}
anchorEl={anchorEl}
Expand Down

0 comments on commit f93e56a

Please sign in to comment.