mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* 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
38 lines
926 B
TypeScript
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>
|
|
);
|
|
};
|