import { css } from '@emotion/css'; import React, { useState } from 'react'; import { Button, HorizontalGroup, useStyles, VerticalGroup } from '@grafana/ui'; function getStyles() { return { wrapper: css` label: wrapper; pointer-events: all; `, }; } interface Props { config: Config; onConfigChange: (config: Config) => void; onPlus: () => void; onMinus: () => void; scale: number; disableZoomOut?: boolean; disableZoomIn?: boolean; } /** * Control buttons for zoom but also some layout config inputs mainly for debugging. */ export function ViewControls>(props: Props) { const { config, onConfigChange, onPlus, onMinus, disableZoomOut, disableZoomIn } = props; const [showConfig, setShowConfig] = useState(false); // For debugging the layout, should be removed here and maybe moved to panel config later on const allowConfiguration = false; const styles = useStyles(getStyles); return (
)} {allowConfiguration && showConfig && Object.keys(config) .filter((k) => k !== 'show') .map((k) => (
{k} { onConfigChange({ ...config, [k]: parseFloat(e.target.value) }); }} />
))}
); }