diff --git a/src/components/quickstarts/QuickstartDashboards.js b/src/components/quickstarts/QuickstartDashboards.js new file mode 100644 index 000000000..143b6d97d --- /dev/null +++ b/src/components/quickstarts/QuickstartDashboards.js @@ -0,0 +1,35 @@ +import React from 'react'; +import { css } from '@emotion/react'; +import pluralize from 'pluralize'; +import Intro from '../Intro'; +import ImageSlider from '../ImageSlider'; +import { quickstart } from '../../types'; + +const QuickstartDashboards = ({ quickstart }) => ( + <> + + {quickstart.name} quickstart contains{' '} + {pluralize('dashboard', quickstart.dashboards?.length ?? 0, true)}. These + interactive visualizations let you easily explore your data, understand + context, and resolve problems faster. + + + {quickstart.dashboards.map((dashboard, index) => ( +
+

{dashboard.name}

+ {dashboard.description &&

{dashboard.description}

} + +
+ ))} + +); + +QuickstartDashboards.propTypes = { + quickstart: quickstart.isRequired, +}; + +export default QuickstartDashboards; diff --git a/src/templates/ObservabilityPackDetails.js b/src/templates/ObservabilityPackDetails.js index 634e30bed..b57c8cf86 100644 --- a/src/templates/ObservabilityPackDetails.js +++ b/src/templates/ObservabilityPackDetails.js @@ -7,6 +7,7 @@ import PageLayout from '../components/PageLayout'; import Tabs from '../components/Tabs'; import EmptyTab from '../components/quickstarts/EmptyTab'; import QuickstartAlerts from '../components/quickstarts/QuickstartAlerts'; +import QuickstartDashboards from '../components/quickstarts/QuickstartDashboards'; import { Layout, PageTools, @@ -17,11 +18,8 @@ import { Link, } from '@newrelic/gatsby-theme-newrelic'; import ImageGallery from '../components/ImageGallery'; -import Intro from '../components/Intro'; import InstallButton from '../components/InstallButton'; -import ImageSlider from '../components/ImageSlider'; import Markdown from '../components/Markdown'; -import pluralize from 'pluralize'; import { quickstart } from '../types'; import { QUICKSTARTS_REPO, @@ -44,40 +42,6 @@ const allowedElements = [ 'hr', ]; -/** - * @param {quickstart} pack - */ -const renderDashboards = (pack) => { - const content = pack.dashboards.map((dashboard, index) => ( - <> -

{dashboard.name}

- - {dashboard.description && ( - <> -

Description

-

{dashboard.description}

- - )} - - )); - - return ( - <> - - {pack.name} observability pack contains{' '} - {pluralize('dashboard', pack.dashboards?.length ?? 0, true)}. These - interactive visualizations let you easily explore your data, understand - context, and resolve problems faster. - - {content} - - ); -}; - const ObservabilityPackDetails = ({ data, location }) => { const pack = data.observabilityPacks; const packUrl = pack.packUrl || QUICKSTARTS_REPO; @@ -151,7 +115,7 @@ const ObservabilityPackDetails = ({ data, location }) => { {pack.dashboards ? ( - renderDashboards(pack) + ) : (