diff --git a/.changeset/fresh-ears-knock.md b/.changeset/fresh-ears-knock.md
new file mode 100644
index 0000000000..1e8b33fd03
--- /dev/null
+++ b/.changeset/fresh-ears-knock.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-shortcuts': minor
+---
+
+Use Avatar instead of custom icon for ShortcutIcon
diff --git a/plugins/shortcuts/src/ShortcutIcon.tsx b/plugins/shortcuts/src/ShortcutIcon.tsx
index 94a894fcb0..be78928452 100644
--- a/plugins/shortcuts/src/ShortcutIcon.tsx
+++ b/plugins/shortcuts/src/ShortcutIcon.tsx
@@ -15,33 +15,28 @@
*/
import React from 'react';
+import { makeStyles } from '@material-ui/core/styles';
+import Avatar from '@material-ui/core/Avatar';
type Props = {
text: string;
color: string;
};
-export const ShortcutIcon = ({ text, color }: Props) => {
- const size = 28;
- return (
-
- );
+const useStyles = makeStyles(theme => ({
+ avatar: (props: Props) => ({
+ color: theme.palette.getContrastText(props.color),
+ backgroundColor: props.color,
+ width: 28,
+ height: 28,
+ fontWeight: 'bold',
+ fontSize: 13,
+ filter: 'contrast(150%) brightness(1.4)',
+ }),
+}));
+
+export const ShortcutIcon = (props: Props) => {
+ const classes = useStyles(props);
+
+ return {props.text};
};
diff --git a/plugins/shortcuts/src/ShortcutItem.test.tsx b/plugins/shortcuts/src/ShortcutItem.test.tsx
index e080026f00..528eb13efa 100644
--- a/plugins/shortcuts/src/ShortcutItem.test.tsx
+++ b/plugins/shortcuts/src/ShortcutItem.test.tsx
@@ -24,7 +24,6 @@ import {
renderInTestApp,
wrapInTestApp,
} from '@backstage/test-utils';
-import { pageTheme } from '@backstage/theme';
import { SidebarContext } from '@backstage/core-components';
describe('ShortcutItem', () => {
@@ -77,27 +76,4 @@ describe('ShortcutItem', () => {
expect(screen.getByText('MT')).toBeInTheDocument();
});
});
-
- it('gets the color based on the theme', async () => {
- const { rerender } = await renderInTestApp(
- ,
- );
-
- expect(document.querySelector('circle')?.getAttribute('fill')).toEqual(
- pageTheme.tool.colors[0],
- );
-
- const newShortcut: Shortcut = {
- id: 'id',
- url: '/catalog',
- title: 'some title',
- };
- rerender(wrapInTestApp());
-
- await waitFor(() => {
- expect(document.querySelector('circle')?.getAttribute('fill')).toEqual(
- pageTheme.home.colors[0],
- );
- });
- });
});