diff --git a/.changeset/warm-masks-ring.md b/.changeset/warm-masks-ring.md index 783f49474e..aefbcf8013 100644 --- a/.changeset/warm-masks-ring.md +++ b/.changeset/warm-masks-ring.md @@ -20,7 +20,7 @@ const techDocsTabsConfig = [ title: 'Golden Path', description: 'Documentation about standards to follow', panelType: 'DocsCardGrid', - panelProps: { showHeader: false, hideSupport: true }, + panelProps: { showHeader: false, showSupport: false }, filterPredicate: entity => entity?.metadata?.tags?.includes('golden-path') ?? false, }, @@ -30,7 +30,7 @@ const techDocsTabsConfig = [ panelType: 'InfoCardGrid', panelProps: { showHeader: false, - hideSupport: true, + showSupport: false, linkDestination: linkDestination, }, filterPredicate: entity => @@ -46,7 +46,7 @@ const techDocsTabsConfig = [ filterPredicate: filterEntity, panelType: 'TechDocsIndexPage', title: 'All', - panelProps: { showHeader: false, hideSupport: true, options: options }, + panelProps: { showHeader: false, showSupport: false, options: options }, }, ], }, @@ -60,7 +60,7 @@ const AppRoutes = () => { {}, }, diff --git a/docs/features/techdocs/how-to-guides.md b/docs/features/techdocs/how-to-guides.md index 6bb4383674..22f48ccee1 100644 --- a/docs/features/techdocs/how-to-guides.md +++ b/docs/features/techdocs/how-to-guides.md @@ -149,7 +149,7 @@ const techDocsTabsConfig = [ title: 'Golden Path', description: 'Documentation about standards to follow', panelType: 'DocsCardGrid', - panelProps: { showHeader: false, hideSupport: true }, + panelProps: { showHeader: false, showSupport: false }, filterPredicate: entity => entity?.metadata?.tags?.includes('golden-path') ?? false, }, @@ -159,7 +159,7 @@ const techDocsTabsConfig = [ panelType: 'InfoCardGrid', panelProps: { showHeader: false, - hideSupport: true, + showSupport: false, linkDestination: linkDestination, }, filterPredicate: entity => @@ -175,7 +175,7 @@ const techDocsTabsConfig = [ filterPredicate: filterEntity, panelType: 'TechDocsIndexPage', title: 'All', - panelProps: { showHeader: false, hideSupport: true, options: options }, + panelProps: { showHeader: false, showSupport: false, options: options }, }, ], }, @@ -189,7 +189,7 @@ const AppRoutes = () => { boolean) | string; // (undocumented) panelCSS?: CSSProperties; + // Warning: (ae-forgotten-export) The symbol "PanelProps" needs to be exported by the entry point index.d.ts + // // (undocumented) - panelProps?: Record; + panelProps?: PanelProps; // (undocumented) panelType: PanelType; // (undocumented) @@ -329,7 +331,7 @@ export type TechDocsCustomHomeProps = { filter?: EntityFilterQuery; title?: string; subtitle?: string; - hideSubtitle?: boolean; + showSubtitle?: boolean; }; // @public @deprecated (undocumented) @@ -347,7 +349,7 @@ export type TechDocsIndexPageProps = { actions?: TableProps['actions']; ownerPickerMode?: EntityOwnerPickerProps['mode']; showHeader?: boolean; - hideSupport?: boolean; + showSupport?: boolean; options?: TableOptions; title?: string; subtitle?: string; @@ -369,7 +371,7 @@ export type TechDocsPageWrapperProps = { children?: React_2.ReactNode; title?: string; subtitle?: string; - hideSubtitle?: boolean; + showSubtitle?: boolean; }; // @public diff --git a/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx b/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx index f4a4e7862a..b3dbf08faa 100644 --- a/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx +++ b/plugins/techdocs/src/home/components/DefaultTechDocsHome.tsx @@ -51,17 +51,17 @@ export const DefaultTechDocsHome = (props: TechDocsIndexPageProps) => { columns, actions, ownerPickerMode, - showHeader, + showHeader = true, options, title, subtitle, - hideSupport, + showSupport = true, } = props; - const Wrapper = showHeader !== false ? TechDocsPageWrapper : React.Fragment; + const Wrapper = showHeader ? TechDocsPageWrapper : React.Fragment; return ( - {hideSupport !== true && ( + {showSupport && ( Discover documentation in your ecosystem. diff --git a/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx b/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx index 66e01ce780..3056f4448c 100644 --- a/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx +++ b/plugins/techdocs/src/home/components/TechDocsCustomHome.test.tsx @@ -127,7 +127,7 @@ describe('TechDocsCustomHome', () => { screen.queryByText('Discover documentation in your ecosystem.'), ).not.toBeInTheDocument(); }); - it('should render SupportButton based on hideSupport prop', async () => { + it('should render SupportButton based on showSupport prop', async () => { const tabsConfig = [ { label: 'First Tab', @@ -137,7 +137,7 @@ describe('TechDocsCustomHome', () => { description: 'First Tab Description', panelType: 'DocsCardGrid' as PanelType, filterPredicate: () => true, - panelProps: { hideSupport: true }, + panelProps: { showSupport: false }, }, ], }, @@ -158,7 +158,7 @@ describe('TechDocsCustomHome', () => { screen.queryByText('Discover documentation in your ecosystem.'), ).not.toBeInTheDocument(); }); - it('should hide subtitle when hideSubtitle is true', async () => { + it('should hide subtitle when showSubtitle is false', async () => { const tabsConfig = [ { label: 'First Tab', @@ -179,7 +179,7 @@ describe('TechDocsCustomHome', () => { tabsConfig={tabsConfig} title="Custom Title" subtitle="Custom Subtitle" - hideSubtitle + showSubtitle={false} /> , { diff --git a/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx b/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx index b939d75893..5067dd07cd 100644 --- a/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx +++ b/plugins/techdocs/src/home/components/TechDocsCustomHome.tsx @@ -25,7 +25,7 @@ import { useEntityOwnership, } from '@backstage/plugin-catalog-react'; import { Entity } from '@backstage/catalog-model'; -import { DocsTable } from './Tables'; +import { DocsTable, DocsTableRow } from './Tables'; import { DocsCardGrid, InfoCardGrid } from './Grids'; import { TechDocsPageWrapper } from './TechDocsPageWrapper'; import { TechDocsIndexPage } from './TechDocsIndexPage'; @@ -38,6 +38,7 @@ import { WarningPanel, SupportButton, ContentHeader, + TableOptions, } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; import { TECHDOCS_ANNOTATION } from '@backstage/plugin-techdocs-common'; @@ -61,6 +62,19 @@ export type PanelType = | 'TechDocsIndexPage' | 'InfoCardGrid'; +/** + * Type representing Panel props + * + * @public + */ +export interface PanelProps { + showHeader?: boolean; + showSupport?: boolean; + options?: TableOptions; + linkContent?: string | JSX.Element; + linkDestination?: (entity: Entity) => string; +} + /** * Type representing a TechDocsCustomHome panel. * @@ -72,7 +86,7 @@ export interface PanelConfig { panelType: PanelType; panelCSS?: CSSProperties; filterPredicate: ((entity: Entity) => boolean) | string; - panelProps?: Record; + panelProps?: PanelProps; } /** @@ -135,7 +149,7 @@ export const CustomDocsPanel = ({ <> {config.panelProps?.showHeader !== false && ( - {index === 0 && config.panelProps?.hideSupport !== true && ( + {index === 0 && config.panelProps?.showSupport !== false && ( Discover documentation in your ecosystem. @@ -163,11 +177,11 @@ export type TechDocsCustomHomeProps = { filter?: EntityFilterQuery; title?: string; subtitle?: string; - hideSubtitle?: boolean; + showSubtitle?: boolean; }; export const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => { - const { tabsConfig, filter, title, subtitle, hideSubtitle } = props; + const { tabsConfig, filter, title, subtitle, showSubtitle = true } = props; const [selectedTab, setSelectedTab] = useState(0); const catalogApi: CatalogApi = useApi(catalogApiRef); @@ -202,7 +216,7 @@ export const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => { @@ -216,7 +230,7 @@ export const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => { { ['actions']; ownerPickerMode?: EntityOwnerPickerProps['mode']; showHeader?: boolean; - hideSupport?: boolean; + showSupport?: boolean; options?: TableOptions; title?: string; subtitle?: string; diff --git a/plugins/techdocs/src/home/components/TechDocsPageWrapper.tsx b/plugins/techdocs/src/home/components/TechDocsPageWrapper.tsx index eedac5ee95..84f8eee327 100644 --- a/plugins/techdocs/src/home/components/TechDocsPageWrapper.tsx +++ b/plugins/techdocs/src/home/components/TechDocsPageWrapper.tsx @@ -28,7 +28,7 @@ export type TechDocsPageWrapperProps = { children?: React.ReactNode; title?: string; subtitle?: string; - hideSubtitle?: boolean; + showSubtitle?: boolean; }; /** @@ -37,7 +37,7 @@ export type TechDocsPageWrapperProps = { * @public */ export const TechDocsPageWrapper = (props: TechDocsPageWrapperProps) => { - const { children, title, subtitle, hideSubtitle } = props; + const { children, title, subtitle, showSubtitle = true } = props; const configApi = useApi(configApiRef); const generatedSubtitle = subtitle || @@ -48,7 +48,7 @@ export const TechDocsPageWrapper = (props: TechDocsPageWrapperProps) => { return ( {children}