|
|
|
|
@ -17,16 +17,15 @@ interface Props { |
|
|
|
|
export function NavLandingPage({ navId }: Props) { |
|
|
|
|
const { node } = useNavModel(navId); |
|
|
|
|
const styles = useStyles2(getStyles); |
|
|
|
|
const directChildren = node.children?.filter((child) => !child.hideFromTabs && !child.children); |
|
|
|
|
const nestedChildren = node.children?.filter((child) => child.children && child.children.length); |
|
|
|
|
const children = node.children?.filter((child) => !child.hideFromTabs); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<Page navId={node.id}> |
|
|
|
|
<Page.Contents> |
|
|
|
|
<div className={styles.content}> |
|
|
|
|
{directChildren && directChildren.length > 0 && ( |
|
|
|
|
{children && children.length > 0 && ( |
|
|
|
|
<section className={styles.grid}> |
|
|
|
|
{directChildren?.map((child) => ( |
|
|
|
|
{children?.map((child) => ( |
|
|
|
|
<NavLandingPageCard |
|
|
|
|
key={child.id} |
|
|
|
|
description={getNavSubTitle(child.id) ?? child.subTitle} |
|
|
|
|
@ -36,22 +35,6 @@ export function NavLandingPage({ navId }: Props) { |
|
|
|
|
))} |
|
|
|
|
</section> |
|
|
|
|
)} |
|
|
|
|
{nestedChildren?.map((child) => ( |
|
|
|
|
<section key={child.id}> |
|
|
|
|
<h2 className={styles.nestedTitle}>{getNavTitle(child.id) ?? child.text}</h2> |
|
|
|
|
<div className={styles.nestedDescription}>{getNavSubTitle(child.id) ?? child.subTitle}</div> |
|
|
|
|
<div className={styles.grid}> |
|
|
|
|
{child.children?.map((child) => ( |
|
|
|
|
<NavLandingPageCard |
|
|
|
|
key={child.id} |
|
|
|
|
description={getNavSubTitle(child.id) ?? child.subTitle} |
|
|
|
|
text={getNavTitle(child.id) ?? child.text} |
|
|
|
|
url={child.url ?? ''} |
|
|
|
|
/> |
|
|
|
|
))} |
|
|
|
|
</div> |
|
|
|
|
</section> |
|
|
|
|
))} |
|
|
|
|
</div> |
|
|
|
|
</Page.Contents> |
|
|
|
|
</Page> |
|
|
|
|
@ -71,10 +54,4 @@ const getStyles = (theme: GrafanaTheme2) => ({ |
|
|
|
|
gridAutoRows: '130px', |
|
|
|
|
padding: theme.spacing(2, 0), |
|
|
|
|
}), |
|
|
|
|
nestedTitle: css({ |
|
|
|
|
margin: theme.spacing(2, 0), |
|
|
|
|
}), |
|
|
|
|
nestedDescription: css({ |
|
|
|
|
color: theme.colors.text.secondary, |
|
|
|
|
}), |
|
|
|
|
}); |
|
|
|
|
|