mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Navigation: Remove plus button behind feature toggle * Navigation: Add home button behind feature toggle * Navigation: Move settings/admin to bottom section behind feature toggle * Navigation: Refactor grafana logo to be a NavBarItem * Navigation: Create new PluginSection and styling changes to support new sections * Navigation: Hack to use mobile menu as a mega menu for now * Navigation: Only render plugin section if there are items * Navigation: mobile menu is always 100% width if toggle is off * Navigation: Reset width back to 48 and fix broken css property * Navigation: Create generic NavBarSection component to reduce repetition * Navigation: Don't show sublinks for core items * Navigation: Comments from UX review * Navigation: Remove mobile menu hack * Navigation: Unit tests for enrichConfigItems and other minor review comments * Navigation: Move section logic to backend * Navigation: Refactor alerting links out into a separate function * Navigation: More tests for isLinkActive * Linting... * Navigation: Create new NavBar component for when feature toggle is enabled
43 lines
1.2 KiB
TypeScript
43 lines
1.2 KiB
TypeScript
import React, { ReactNode } from 'react';
|
|
import { css, cx } from '@emotion/css';
|
|
import { GrafanaTheme2 } from '@grafana/data';
|
|
import { useTheme2 } from '@grafana/ui';
|
|
import config from '../../config';
|
|
|
|
export interface Props {
|
|
children: ReactNode;
|
|
className?: string;
|
|
}
|
|
|
|
export function NavBarSection({ children, className }: Props) {
|
|
const newNavigationEnabled = config.featureToggles.newNavigation;
|
|
const theme = useTheme2();
|
|
const styles = getStyles(theme, newNavigationEnabled);
|
|
|
|
return (
|
|
<div data-testid="navbar-section" className={cx(styles.container, className)}>
|
|
{children}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const getStyles = (theme: GrafanaTheme2, newNavigationEnabled: boolean) => ({
|
|
container: css`
|
|
display: none;
|
|
|
|
${theme.breakpoints.up('md')} {
|
|
background-color: ${newNavigationEnabled ? theme.colors.background.primary : 'inherit'};
|
|
border: ${newNavigationEnabled ? `1px solid ${theme.components.panel.borderColor}` : 'none'};
|
|
border-radius: 2px;
|
|
display: flex;
|
|
flex-direction: inherit;
|
|
}
|
|
|
|
.sidemenu-open--xs & {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: ${theme.spacing(1)};
|
|
}
|
|
`,
|
|
});
|