From 4fb960003a5fac08d1c6bb5136c6fd575e373f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Pi=C4=85tkiewicz?= Date: Mon, 12 Feb 2024 11:14:52 +0100 Subject: [PATCH] Parameterize LinguistCard title MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Piotr Piątkiewicz --- .changeset/lazy-terms-shake.md | 5 +++++ plugins/linguist/README.md | 6 ++++++ .../linguist/src/components/LinguistCard/LinguistCard.tsx | 4 ++-- 3 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 .changeset/lazy-terms-shake.md diff --git a/.changeset/lazy-terms-shake.md b/.changeset/lazy-terms-shake.md new file mode 100644 index 0000000000..41f5292709 --- /dev/null +++ b/.changeset/lazy-terms-shake.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-linguist': minor +--- + +Allow to optionally pass component's title as LinguistCard parameter diff --git a/plugins/linguist/README.md b/plugins/linguist/README.md index 7ad70f1db6..72855c0894 100644 --- a/plugins/linguist/README.md +++ b/plugins/linguist/README.md @@ -79,6 +79,12 @@ To setup the Linguist Card frontend you'll need to do the following steps: ``` +3. (optionally) Set component's title - default is "Languages" + + ```tsx + + ``` + **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 diff --git a/plugins/linguist/src/components/LinguistCard/LinguistCard.tsx b/plugins/linguist/src/components/LinguistCard/LinguistCard.tsx index 6a07a958c2..3b63abd406 100644 --- a/plugins/linguist/src/components/LinguistCard/LinguistCard.tsx +++ b/plugins/linguist/src/components/LinguistCard/LinguistCard.tsx @@ -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 ( - +