DashNav: Pass typed event through the DashNav button onClick handler (#32084)

* Pass typed event thorough the DashNav button onClick handler

Event.stopPropagation() method needs to be called in some cases. This change addresses typescript error Type '(event: ...) => void' is not assignable to type '() => void'.

* Pass typed event thorough the DashNav button onClick handler

* Import MouseEvent from React
This commit is contained in:
Denis Hilt 2021-03-18 10:23:58 +03:00 committed by GitHub
parent 2d72b4e69e
commit 8fafe95728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,5 @@
// Libraries // Libraries
import React, { FunctionComponent } from 'react'; import React, { FunctionComponent, MouseEvent } from 'react';
import { css } from 'emotion'; import { css } from 'emotion';
// Components // Components
import { IconName, IconType, IconSize, IconButton, useTheme, stylesFactory } from '@grafana/ui'; import { IconName, IconType, IconSize, IconButton, useTheme, stylesFactory } from '@grafana/ui';
@ -8,7 +8,7 @@ import { GrafanaTheme } from '@grafana/data';
interface Props { interface Props {
icon?: IconName; icon?: IconName;
tooltip: string; tooltip: string;
onClick?: () => void; onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
href?: string; href?: string;
children?: React.ReactNode; children?: React.ReactNode;
iconType?: IconType; iconType?: IconType;