mirror of
https://github.com/grafana/grafana.git
synced 2025-02-15 10:03:33 -06:00
* InlineSwitch: Added missing InlineSwitch component and fixed two places that used unaligned inline switch * Fixed e2e tests
24 lines
660 B
TypeScript
24 lines
660 B
TypeScript
import React, { ChangeEvent, PropsWithChildren, ReactElement } from 'react';
|
|
import { InlineField, InlineSwitch } from '@grafana/ui';
|
|
interface VariableSwitchFieldProps {
|
|
value: boolean;
|
|
name: string;
|
|
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
tooltip?: string;
|
|
ariaLabel?: string;
|
|
}
|
|
|
|
export function VariableSwitchField({
|
|
value,
|
|
name,
|
|
tooltip,
|
|
onChange,
|
|
ariaLabel,
|
|
}: PropsWithChildren<VariableSwitchFieldProps>): ReactElement {
|
|
return (
|
|
<InlineField label={name} labelWidth={20} tooltip={tooltip}>
|
|
<InlineSwitch label={name} value={value} onChange={onChange} aria-label={ariaLabel} />
|
|
</InlineField>
|
|
);
|
|
}
|