From bf67dce73174e7c5087af7ed5d67b145ad75b105 Mon Sep 17 00:00:00 2001 From: ivgo Date: Tue, 18 Jul 2023 08:51:16 +0200 Subject: [PATCH] Make title a more optional parameter Signed-off-by: ivgo --- .changeset/mean-squids-relax.md | 5 +++++ plugins/home-react/api-report.md | 6 +++--- plugins/home-react/src/components/SettingsModal.tsx | 6 ++++-- plugins/home-react/src/extensions.tsx | 9 ++++----- plugins/home/README.md | 2 ++ plugins/home/api-report.md | 4 ++-- .../home/src/componentRenderers/ComponentAccordion.tsx | 2 +- 7 files changed, 21 insertions(+), 13 deletions(-) create mode 100644 .changeset/mean-squids-relax.md diff --git a/.changeset/mean-squids-relax.md b/.changeset/mean-squids-relax.md new file mode 100644 index 0000000000..558b42fcfc --- /dev/null +++ b/.changeset/mean-squids-relax.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-home-react': patch +--- + +Make `title` optional when defining the `createCardExtension` diff --git a/plugins/home-react/api-report.md b/plugins/home-react/api-report.md index d6a2f92589..4806cf7be0 100644 --- a/plugins/home-react/api-report.md +++ b/plugins/home-react/api-report.md @@ -55,7 +55,7 @@ export type ComponentRenderer = { // @public export function createCardExtension(options: { - title: string; + title?: string; components: () => Promise; name?: string; description?: string; @@ -65,14 +65,14 @@ export function createCardExtension(options: { // @public (undocumented) export type RendererProps = { - title: string; + title?: string; } & ComponentParts; // @public (undocumented) export const SettingsModal: (props: { open: boolean; close: Function; - componentName: string; + componentName?: string; children: JSX.Element; }) => JSX.Element; ``` diff --git a/plugins/home-react/src/components/SettingsModal.tsx b/plugins/home-react/src/components/SettingsModal.tsx index ace9944f28..43cb16bb40 100644 --- a/plugins/home-react/src/components/SettingsModal.tsx +++ b/plugins/home-react/src/components/SettingsModal.tsx @@ -27,14 +27,16 @@ import { export const SettingsModal = (props: { open: boolean; close: Function; - componentName: string; + componentName?: string; children: JSX.Element; }) => { const { open, close, componentName, children } = props; return ( close()}> - Settings - {componentName} + + {componentName ? `Settings - ${componentName}` : 'Settings'} + {children}