Navigation: Minor tweak to dockedMegaMenu to make it slightly tighter (#77493)

minor tweak to dockedMegaMenu to make it slightly tighter
This commit is contained in:
Ashley Harrison
2023-11-01 11:56:58 +00:00
committed by GitHub
parent f1e42fefb4
commit 2d5e602b2d
2 changed files with 9 additions and 5 deletions

View File

@@ -63,7 +63,7 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick }: Props) {
<li ref={item} className={styles.listItem}> <li ref={item} className={styles.listItem}>
<div <div
className={cx(styles.menuItem, { className={cx(styles.menuItem, {
[styles.hasIcon]: Boolean(level === 0 && link.icon), [styles.menuItemWithIcon]: Boolean(level === 0 && link.icon),
})} })}
> >
{level !== 0 && <Indent level={level === MAX_DEPTH ? level - 1 : level} spacing={3} />} {level !== 0 && <Indent level={level === MAX_DEPTH ? level - 1 : level} spacing={3} />}
@@ -93,6 +93,7 @@ export function MegaMenuItem({ link, activeItem, level = 0, onClick }: Props) {
<div <div
className={cx(styles.labelWrapper, { className={cx(styles.labelWrapper, {
[styles.hasActiveChild]: hasActiveChild, [styles.hasActiveChild]: hasActiveChild,
[styles.labelWrapperWithIcon]: Boolean(level === 0 && link.icon),
})} })}
> >
{level === 0 && link.icon && ( {level === 0 && link.icon && (
@@ -141,9 +142,12 @@ const getStyles = (theme: GrafanaTheme2) => ({
alignItems: 'center', alignItems: 'center',
gap: theme.spacing(1), gap: theme.spacing(1),
height: theme.spacing(4), height: theme.spacing(4),
paddingLeft: theme.spacing(1), paddingLeft: theme.spacing(0.5),
position: 'relative', position: 'relative',
}), }),
menuItemWithIcon: css({
paddingLeft: theme.spacing(0),
}),
collapseButtonWrapper: css({ collapseButtonWrapper: css({
display: 'flex', display: 'flex',
justifyContent: 'center', justifyContent: 'center',
@@ -178,9 +182,10 @@ const getStyles = (theme: GrafanaTheme2) => ({
alignItems: 'center', alignItems: 'center',
gap: theme.spacing(2), gap: theme.spacing(2),
minWidth: 0, minWidth: 0,
paddingLeft: theme.spacing(1),
}), }),
hasIcon: css({ labelWrapperWithIcon: css({
paddingLeft: theme.spacing(0), paddingLeft: theme.spacing(0.5),
}), }),
hasActiveChild: css({ hasActiveChild: css({
color: theme.colors.text.primary, color: theme.colors.text.primary,

View File

@@ -88,7 +88,6 @@ const getStyles = (theme: GrafanaTheme2, isActive: Props['isActive']) => ({
display: 'flex', display: 'flex',
gap: '0.5rem', gap: '0.5rem',
height: '100%', height: '100%',
paddingLeft: theme.spacing(1),
width: '100%', width: '100%',
}), }),
}); });