@backstage/plugin-techdocs
Version:
The Backstage plugin that renders technical documentation for your components
25 lines (22 loc) • 1.19 kB
JavaScript
import { jsx } from 'react/jsx-runtime';
import DocsIcon from '@material-ui/icons/Description';
import { useRouteRef } from '@backstage/core-plugin-api';
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
import { TECHDOCS_ANNOTATION, TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';
import { buildTechDocsURL } from '@backstage/plugin-techdocs-react';
import { useEntity } from '@backstage/plugin-catalog-react';
import { techdocsTranslationRef } from '../../translation.esm.js';
import { rootDocsRouteRef } from '../../routes.esm.js';
function useTechdocsReaderIconLinkProps() {
const { entity } = useEntity();
const viewTechdocLink = useRouteRef(rootDocsRouteRef);
const { t } = useTranslationRef(techdocsTranslationRef);
return {
label: t("aboutCard.viewTechdocs"),
disabled: !(entity.metadata.annotations?.[TECHDOCS_ANNOTATION] || entity.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]) || !viewTechdocLink,
icon: /* @__PURE__ */ jsx(DocsIcon, {}),
href: buildTechDocsURL(entity, viewTechdocLink)
};
}
export { useTechdocsReaderIconLinkProps };
//# sourceMappingURL=useTechdocsReaderIconLinkProps.esm.js.map