+ ))}
+ >
+ ) : (
+ emptyState || (
+
+ DOCS
+
+ }
+ />
+ )
+ );
+};
diff --git a/plugins/home/src/homePageComponents/FeaturedDocsCard/FeaturedDocsCard.stories.tsx b/plugins/home/src/homePageComponents/FeaturedDocsCard/FeaturedDocsCard.stories.tsx
new file mode 100644
index 0000000000..91f0dbf27e
--- /dev/null
+++ b/plugins/home/src/homePageComponents/FeaturedDocsCard/FeaturedDocsCard.stories.tsx
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2022 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { FeaturedDocsCard } from '../../plugin';
+import React, { ComponentType, PropsWithChildren } from 'react';
+import { wrapInTestApp, TestApiProvider } from '@backstage/test-utils';
+import { catalogApiRef, entityRouteRef } from '@backstage/plugin-catalog-react';
+import { Grid } from '@material-ui/core';
+
+const docsEntities = [
+ {
+ apiVersion: '1',
+ kind: 'Location',
+ metadata: {
+ name: 'getting-started-with-backstage',
+ title: 'Getting Started Docs',
+ description:
+ 'An awesome doc you want to feature to help out your customers. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis pretium magna ut molestie lacinia. Nullam eget bibendum est, vitae finibus neque.',
+ },
+ spec: {
+ type: 'documentation',
+ },
+ },
+];
+
+const mockCatalogApi = {
+ getEntities: async () => ({ items: docsEntities }),
+};
+
+export default {
+ title: 'Plugins/Home/Components/FeaturedDocsCard',
+ decorators: [
+ (Story: ComponentType>) =>
+ wrapInTestApp(
+
+
+ ,
+ {
+ mountedRoutes: {
+ '/catalog/:namespace/:kind/:name': entityRouteRef,
+ },
+ },
+ ),
+ ],
+};
+
+export const Default = () => {
+ return (
+
+
+
+ );
+};
diff --git a/plugins/home/src/homePageComponents/FeaturedDocsCard/index.ts b/plugins/home/src/homePageComponents/FeaturedDocsCard/index.ts
new file mode 100644
index 0000000000..5151fa370c
--- /dev/null
+++ b/plugins/home/src/homePageComponents/FeaturedDocsCard/index.ts
@@ -0,0 +1,18 @@
+/*
+ * Copyright 2022 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+export { Content } from './Content';
+export type { FeaturedDocsCardProps } from './Content';
diff --git a/plugins/home/src/homePageComponents/index.ts b/plugins/home/src/homePageComponents/index.ts
index 9149afa295..dc611291fb 100644
--- a/plugins/home/src/homePageComponents/index.ts
+++ b/plugins/home/src/homePageComponents/index.ts
@@ -18,3 +18,4 @@ export type { ToolkitContentProps, Tool } from './Toolkit';
export type { ClockConfig } from './HeaderWorldClock';
export type { WelcomeTitleLanguageProps } from './WelcomeTitle';
export type { VisitedByTypeProps, VisitedByTypeKind } from './VisitedByType';
+export type { FeaturedDocsCardProps } from './FeaturedDocsCard';
diff --git a/plugins/home/src/index.ts b/plugins/home/src/index.ts
index a80f8bd93d..154186f169 100644
--- a/plugins/home/src/index.ts
+++ b/plugins/home/src/index.ts
@@ -34,6 +34,7 @@ export {
HeaderWorldClock,
HomePageTopVisited,
HomePageRecentlyVisited,
+ FeaturedDocsCard,
} from './plugin';
export * from './components';
export * from './assets';
diff --git a/plugins/home/src/plugin.ts b/plugins/home/src/plugin.ts
index ab8c46baa1..5361ecd9c0 100644
--- a/plugins/home/src/plugin.ts
+++ b/plugins/home/src/plugin.ts
@@ -23,7 +23,11 @@ import {
storageApiRef,
} from '@backstage/core-plugin-api';
import { createCardExtension } from '@backstage/plugin-home-react';
-import { ToolkitContentProps, VisitedByTypeProps } from './homePageComponents';
+import {
+ ToolkitContentProps,
+ VisitedByTypeProps,
+ FeaturedDocsCardProps,
+} from './homePageComponents';
import { rootRouteRef } from './routes';
import { VisitsStorageApi, visitsApiRef } from './api';
@@ -210,3 +214,16 @@ export const HomePageRecentlyVisited = homePlugin.provide(
import('./homePageComponents/VisitedByType/RecentlyVisited'),
}),
);
+
+/**
+ * A component to display specific Featured Docs.
+ *
+ * @public
+ */
+export const FeaturedDocsCard = homePlugin.provide(
+ createCardExtension({
+ name: 'FeaturedDocsCard',
+ title: 'Featured Docs',
+ components: () => import('./homePageComponents/FeaturedDocsCard'),
+ }),
+);
diff --git a/yarn.lock b/yarn.lock
index 15365689ff..714a17d713 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -7492,6 +7492,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@backstage/plugin-home@workspace:plugins/home"
dependencies:
+ "@backstage/catalog-client": "workspace:^"
"@backstage/catalog-model": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"