grafana/public/app/plugins/datasource/cloudwatch/components/Alias.tsx
Shirley ba58b34219
CloudWatch: a11y: Add missing aria labels on explore metrics/logs editor (#43580)
* CloudWatch: a11y: Add missing aria labels on explore metrics/logs editor
2022-01-05 09:46:05 +01:00

22 lines
591 B
TypeScript

import React, { FunctionComponent, useState } from 'react';
import { debounce } from 'lodash';
import { Input } from '@grafana/ui';
export interface Props {
onChange: (alias: any) => void;
value: string;
}
export const Alias: FunctionComponent<Props> = ({ value = '', onChange }) => {
const [alias, setAlias] = useState(value);
const propagateOnChange = debounce(onChange, 1500);
onChange = (e: any) => {
setAlias(e.target.value);
propagateOnChange(e.target.value);
};
return <Input type="text" value={alias} onChange={onChange} aria-label="Optional alias" />;
};