import React, { useRef } from 'react'; import { GrafanaTheme2, NavModelItem } from '@grafana/data'; import { CustomScrollbar, Icon, IconButton, IconName, useTheme2 } from '@grafana/ui'; import { FocusScope } from '@react-aria/focus'; import { useOverlay } from '@react-aria/overlays'; import { css } from '@emotion/css'; import { NavBarMenuItem } from './NavBarMenuItem'; export interface Props { activeItem?: NavModelItem; navItems: NavModelItem[]; onClose: () => void; } export function NavBarMenu({ activeItem, navItems, onClose }: Props) { const theme = useTheme2(); const styles = getStyles(theme); const ref = useRef(null); const { overlayProps } = useOverlay( { isDismissable: true, isOpen: true, onClose, }, ref ); return (
); } NavBarMenu.displayName = 'NavBarMenu'; const getStyles = (theme: GrafanaTheme2) => ({ container: css` background-color: ${theme.colors.background.canvas}; bottom: 0; display: flex; flex-direction: column; left: 0; min-width: 300px; position: fixed; right: 0; top: 0; ${theme.breakpoints.up('md')} { border-right: 1px solid ${theme.colors.border.weak}; right: unset; } `, content: css` display: flex; flex-direction: column; overflow: auto; `, header: css` border-bottom: 1px solid ${theme.colors.border.weak}; display: flex; justify-content: space-between; padding: ${theme.spacing(2)}; `, item: css` padding: ${theme.spacing(1)} ${theme.spacing(2)}; `, section: css` border-bottom: 1px solid ${theme.colors.border.weak}; `, sectionHeader: css` color: ${theme.colors.text.primary}; font-size: ${theme.typography.h5.fontSize}; padding: ${theme.spacing(1)} ${theme.spacing(2)}; `, });