feat(home): add entity presentation api to home page widgets
Signed-off-by: Benjamin Janssens <benji.janssens@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-home': patch
|
||||
---
|
||||
|
||||
Added the Catalog presentation API to the HomePageRecentlyVisited and HomePageTopVisited components
|
||||
@@ -18,16 +18,28 @@ import Typography from '@material-ui/core/Typography';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { Visit } from '../../api/VisitsApi';
|
||||
import { Link } from '@backstage/core-components';
|
||||
import { EntityRefLink } from '@backstage/plugin-catalog-react';
|
||||
|
||||
const useStyles = makeStyles(_theme => ({
|
||||
const useStyles = makeStyles(theme => ({
|
||||
name: {
|
||||
marginLeft: '0.8rem',
|
||||
marginRight: '0.8rem',
|
||||
fontSize: theme.typography.body1.fontSize,
|
||||
},
|
||||
}));
|
||||
export const ItemName = ({ visit }: { visit: Visit }) => {
|
||||
const classes = useStyles();
|
||||
|
||||
if (visit.entityRef)
|
||||
return (
|
||||
<EntityRefLink
|
||||
entityRef={visit.entityRef}
|
||||
className={classes.name}
|
||||
hideIcon
|
||||
disableTooltip
|
||||
/>
|
||||
);
|
||||
|
||||
return (
|
||||
<Typography
|
||||
component={Link}
|
||||
|
||||
Reference in New Issue
Block a user