Parameterize LinguistCard title

Signed-off-by: Piotr Piątkiewicz <piatkiewicz.piotr@gmail.com>
This commit is contained in:
Piotr Piątkiewicz
2024-02-12 11:14:52 +01:00
parent 58ba5c6794
commit 4fb960003a
3 changed files with 13 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-linguist': minor
---
Allow to optionally pass component's title as LinguistCard parameter
+6
View File
@@ -79,6 +79,12 @@ To setup the Linguist Card frontend you'll need to do the following steps:
</Grid>
```
3. (optionally) Set component's title - default is "Languages"
```tsx
<EntityLinguistCard title="Tech stack" />
```
**Notes:**
- The `if` prop is optional on the `EntitySwitch.Case`, you can remove it if you always want to see the tab even if the entity being viewed does not have the needed annotation
@@ -55,7 +55,7 @@ const useStyles = makeStyles(theme => ({
},
}));
export const LinguistCard = () => {
export const LinguistCard = ({ title = 'Languages' }) => {
const classes = useStyles();
const theme = useTheme();
const { entity } = useEntity();
@@ -70,7 +70,7 @@ export const LinguistCard = () => {
if (items && items.languageCount === 0 && items.totalBytes === 0) {
return (
<InfoCard title="Languages" className={classes.infoCard}>
<InfoCard title={title} className={classes.infoCard}>
<Grid container spacing={3}>
<Box p={2}>
<Typography>