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

View File

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