add docs and clean up
Signed-off-by: nikolar <reyna.nikolayev@autodesk.com>
This commit is contained in:
@@ -45,7 +45,7 @@ const useStyles = makeStyles(
|
||||
export type InfoCardGridProps = {
|
||||
entities: Entity[] | undefined;
|
||||
linkContent?: string | JSX.Element;
|
||||
linkDest?: (entity: Entity) => string;
|
||||
linkDestination?: (entity: Entity) => string;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -54,13 +54,13 @@ export type InfoCardGridProps = {
|
||||
* @public
|
||||
*/
|
||||
export const InfoCardGrid = (props: InfoCardGridProps) => {
|
||||
const { entities, linkContent, linkDest } = props;
|
||||
const { entities, linkContent, linkDestination } = props;
|
||||
const classes = useStyles();
|
||||
const getRouteToReaderPageFor = useRouteRef(rootDocsRouteRef);
|
||||
const config = useApi(configApiRef);
|
||||
const linkDestination = (entity: Entity) =>
|
||||
typeof linkDest === 'function'
|
||||
? linkDest(entity)
|
||||
const linkRoute = (entity: Entity) =>
|
||||
typeof linkDestination === 'function'
|
||||
? linkDestination(entity)
|
||||
: getRouteToReaderPageFor({
|
||||
namespace: toLowerMaybe(
|
||||
entity.metadata.namespace ?? 'default',
|
||||
@@ -84,7 +84,7 @@ export const InfoCardGrid = (props: InfoCardGridProps) => {
|
||||
<div>{entity?.metadata?.description}</div>
|
||||
<div className={classes.linkSpacer} />
|
||||
<Link
|
||||
to={linkDestination(entity)}
|
||||
to={linkRoute(entity)}
|
||||
className={classes.readMoreLink}
|
||||
data-testid="read-docs-link"
|
||||
>
|
||||
|
||||
@@ -92,7 +92,12 @@ export interface TabConfig {
|
||||
*/
|
||||
export type TabsConfig = TabConfig[];
|
||||
|
||||
const CustomPanel = ({
|
||||
/**
|
||||
* Component which can be used to render entities in a custom way.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const CustomDocsPanel = ({
|
||||
config,
|
||||
entities,
|
||||
index,
|
||||
@@ -241,7 +246,7 @@ export const TechDocsCustomHome = (props: TechDocsCustomHomeProps) => {
|
||||
/>
|
||||
<Content data-testid="techdocs-content">
|
||||
{currentTabConfig.panels.map((config, index) => (
|
||||
<CustomPanel
|
||||
<CustomDocsPanel
|
||||
key={index}
|
||||
config={config}
|
||||
entities={!!entities ? entities : []}
|
||||
|
||||
@@ -24,6 +24,7 @@ export type {
|
||||
TabsConfig,
|
||||
TechDocsCustomHomeProps,
|
||||
} from './TechDocsCustomHome';
|
||||
export { CustomDocsPanel } from './TechDocsCustomHome';
|
||||
export type { TechDocsIndexPageProps } from './TechDocsIndexPage';
|
||||
export * from './TechDocsPageWrapper';
|
||||
export * from './TechDocsPicker';
|
||||
|
||||
Reference in New Issue
Block a user