Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

978 B
Raw Blame
import { Plus } from '@signozhq/icons';
import { Button } from '@signozhq/ui/button';
import { Tooltip } from '@signozhq/ui/tooltip';

interface SectionHeaderQuickAddConfig {
	label: string;
	testId: string;
}

interface SectionHeaderQuickAddProps {
	action: SectionHeaderQuickAddConfig;
	/** Expands the section and runs the editor's registered add handler. */
	onClick: () => void;
}

/** Quick-add control rendered in a configuration section's header, beside the chevron. */
function SectionHeaderQuickAdd({
	action,
	onClick,
}: SectionHeaderQuickAddProps): JSX.Element {
	return (
		<Tooltip title="Quick Add" side="top">
			<Button
				type="button"
				variant="ghost"
				color="secondary"
				size="sm"
				icon
				aria-label={action.label}
				// Not `testId`: TooltipTrigger's Slot merge overwrites it with undefined.
				testId={action.testId}
				onClick={onClick}
			>
				<Plus size={15} />
			</Button>
		</Tooltip>
	);
}

export default SectionHeaderQuickAdd;