From 34900b0ca6e860512ee6bdf1d939c2495df1bbe3 Mon Sep 17 00:00:00 2001 From: blam Date: Tue, 15 Jun 2021 12:00:39 +0200 Subject: [PATCH] chore: removing the test usages in the app, and fixing the typings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Fredrik Adelöw Co-authored-by: Johan Haals Signed-off-by: blam --- packages/app/src/App.tsx | 4 +--- packages/app/src/components/catalog/EntityPage.tsx | 8 +++----- packages/core-app-api/src/routing/FeatureFlagged.tsx | 6 ++++-- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/app/src/App.tsx b/packages/app/src/App.tsx index de11afeed4..a7ed41d2a4 100644 --- a/packages/app/src/App.tsx +++ b/packages/app/src/App.tsx @@ -114,9 +114,7 @@ const routes = ( path="/tech-radar" element={} /> - - } /> - + } /> } /> } /> diff --git a/packages/app/src/components/catalog/EntityPage.tsx b/packages/app/src/components/catalog/EntityPage.tsx index 41d2d6f8c2..d1c5d44f85 100644 --- a/packages/app/src/components/catalog/EntityPage.tsx +++ b/packages/app/src/components/catalog/EntityPage.tsx @@ -306,11 +306,9 @@ const serviceEntityPage = ( - - - - - + + + diff --git a/packages/core-app-api/src/routing/FeatureFlagged.tsx b/packages/core-app-api/src/routing/FeatureFlagged.tsx index 809eb7c69c..40ef445f92 100644 --- a/packages/core-app-api/src/routing/FeatureFlagged.tsx +++ b/packages/core-app-api/src/routing/FeatureFlagged.tsx @@ -19,11 +19,13 @@ import { useApi, attachComponentData, } from '@backstage/core-plugin-api'; +import React, { ReactNode } from 'react'; -export type FeatureFlaggedProps = { children: JSX.Element | null } & ( +export type FeatureFlaggedProps = { children: ReactNode } & ( | { with: string } | { without: string } ); + export const FeatureFlagged = (props: FeatureFlaggedProps) => { const { children } = props; const featureFlagApi = useApi(featureFlagsApiRef); @@ -31,7 +33,7 @@ export const FeatureFlagged = (props: FeatureFlaggedProps) => { 'with' in props ? featureFlagApi.isActive(props.with) : !featureFlagApi.isActive(props.without); - return isEnabled ? children : null; + return <>{isEnabled ? children : null}; }; attachComponentData(FeatureFlagged, 'core.featureFlagged', true);