import { css, cx } from '@emotion/css'; import * as React from 'react'; import { Link } from 'react-router-dom-v5-compat'; import { useToggle } from 'react-use'; import { GrafanaTheme2 } from '@grafana/data'; import { Button, Dropdown, Icon, Menu, MenuItem, Stack, useStyles2 } from '@grafana/ui'; import { GrafanaReceiversExporter } from '../export/GrafanaReceiversExporter'; interface Props { title: string; description: string; addButtonLabel: string; addButtonTo: string; className?: string; showButton?: boolean; canReadSecrets?: boolean; showExport?: boolean; } export const ReceiversSection = ({ className, title, description, addButtonLabel, addButtonTo, children, showButton = true, canReadSecrets = false, showExport = false, }: React.PropsWithChildren) => { const styles = useStyles2(getStyles); const showMore = showExport; const [showExportDrawer, toggleShowExportDrawer] = useToggle(false); const newMenu = {showExport && }; return (

{title}

{description}
{showButton && ( )} {showMore && ( )}
{children} {showExportDrawer && }
); }; const getStyles = (theme: GrafanaTheme2) => ({ heading: css({ display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end', }), description: css({ color: theme.colors.text.secondary, }), });