feat: add overrideable FavoriteToggle to core-components
Signed-off-by: Carl-Erik Bergström <cbergstrom@spotify.com>
This commit is contained in:
@@ -17,15 +17,7 @@
|
||||
import React from 'react';
|
||||
import ShareIcon from '@material-ui/icons/Share';
|
||||
import { DocsTableRow } from './types';
|
||||
import { withStyles } from '@material-ui/core/styles';
|
||||
import Star from '@material-ui/icons/Star';
|
||||
import StarBorder from '@material-ui/icons/StarBorder';
|
||||
|
||||
const YellowStar = withStyles({
|
||||
root: {
|
||||
color: '#f3ba37',
|
||||
},
|
||||
})(Star);
|
||||
import { FavoriteToggleIcon } from '@backstage/core-components';
|
||||
|
||||
/**
|
||||
* Not directly exported, but through DocsTable.actions and EntityListDocsTable.actions
|
||||
@@ -52,7 +44,7 @@ export const actionFactories = {
|
||||
const isStarred = isStarredEntity(entity);
|
||||
return {
|
||||
cellStyle: { paddingLeft: '1em' },
|
||||
icon: () => (isStarred ? <YellowStar /> : <StarBorder />),
|
||||
icon: () => <FavoriteToggleIcon isFavorite={isStarred} />,
|
||||
tooltip: isStarred ? 'Remove from favorites' : 'Add to favorites',
|
||||
onClick: () => toggleStarredEntity(entity),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user