Files
grafana/public/app/features/dashboard/components/DashNav/DashNavButton.tsx
Hugo Häggmark 841cffbe9a e2e: Migrates query variable CRUD tests to new framework (#21146)
* Refactor: Adds params to visit

* Refactor: Restructures exported Pages somewhat

* Refactor: Moves more into new framework but holdup because of bugs in digest

* Refactor: Finish migrating templating e2e tests to new framework

* Refactor: Changes after merge with master

* Refactor: Removes weird change

* Refactor: Adds duplication test

* Refactor: Adds move down and move up variable asserts

* Refactor: Adds some test to value select dropdown
2019-12-18 06:13:58 +01:00

38 lines
926 B
TypeScript

// Libraries
import React, { FunctionComponent } from 'react';
// Components
import { Tooltip } from '@grafana/ui';
import { e2e } from '@grafana/e2e';
interface Props {
icon: string;
tooltip: string;
classSuffix: string;
onClick?: () => void;
href?: string;
}
export const DashNavButton: FunctionComponent<Props> = ({ icon, tooltip, classSuffix, onClick, href }) => {
if (onClick) {
return (
<Tooltip content={tooltip}>
<button
className={`btn navbar-button navbar-button--${classSuffix}`}
onClick={onClick}
aria-label={e2e.pages.Dashboard.Toolbar.selectors.toolbarItems(tooltip)}
>
<i className={icon} />
</button>
</Tooltip>
);
}
return (
<Tooltip content={tooltip}>
<a className={`btn navbar-button navbar-button--${classSuffix}`} href={href}>
<i className={icon} />
</a>
</Tooltip>
);
};