@backstage/plugin-techdocs
Version:
The Backstage plugin that renders technical documentation for your components
66 lines (63 loc) • 2.7 kB
JavaScript
import { jsx, jsxs } from 'react/jsx-runtime';
import Grid from '@material-ui/core/Grid';
import { makeStyles } from '@material-ui/core/styles';
import { TechDocsShadowDom } from '@backstage/plugin-techdocs-react';
import { Content, Progress } from '@backstage/core-components';
import { TechDocsSearch } from '../../../search/components/TechDocsSearch.esm.js';
import { TechDocsStateIndicator } from '../TechDocsStateIndicator.esm.js';
import { withTechDocsReaderProvider } from '../TechDocsReaderProvider.esm.js';
import { TechDocsReaderPageContentAddons } from './TechDocsReaderPageContentAddons.esm.js';
import { useTechDocsReaderContentData } from '../../../hooks/useTechDocsReaderContentData.esm.js';
const useStyles = makeStyles({
search: {
width: "100%",
"@media (min-width: 76.1875em)": {
width: "calc(100% - 34.4rem)",
margin: "0 auto"
},
"@media print": {
display: "none"
}
}
});
const TechDocsReaderPageContent = withTechDocsReaderProvider(
(props) => {
const { withSearch = true, searchResultUrlMapper } = props;
const classes = useStyles();
const {
entityRef,
entityMetadata,
dom,
handleAppend,
isNotFound,
isDomReady,
showProgress,
NotFoundErrorPage
} = useTechDocsReaderContentData({
defaultPath: props.defaultPath,
onReady: props.onReady
});
if (isNotFound) return /* @__PURE__ */ jsx(NotFoundErrorPage, {});
if (!isDomReady) {
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(Grid, { container: true, children: /* @__PURE__ */ jsx(Grid, { xs: 12, item: true, children: /* @__PURE__ */ jsx(TechDocsStateIndicator, {}) }) }) });
}
return /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsxs(Grid, { container: true, children: [
/* @__PURE__ */ jsx(Grid, { xs: 12, item: true, children: /* @__PURE__ */ jsx(TechDocsStateIndicator, {}) }),
withSearch && /* @__PURE__ */ jsx(Grid, { className: classes.search, xs: "auto", item: true, children: /* @__PURE__ */ jsx(
TechDocsSearch,
{
entityId: entityRef,
entityTitle: entityMetadata?.metadata?.title,
searchResultUrlMapper
}
) }),
/* @__PURE__ */ jsxs(Grid, { xs: 12, item: true, children: [
showProgress && /* @__PURE__ */ jsx(Progress, {}),
/* @__PURE__ */ jsx(TechDocsShadowDom, { element: dom, onAppend: handleAppend, children: /* @__PURE__ */ jsx(TechDocsReaderPageContentAddons, {}) })
] })
] }) });
}
);
const Reader = TechDocsReaderPageContent;
export { Reader, TechDocsReaderPageContent };
//# sourceMappingURL=TechDocsReaderPageContent.esm.js.map