mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Chore: Adds neccessary packages * Wip: Initial dummy test in place * Feature: Downloads Chromium if needed * Fix: Adds global config object * Refactor: Adds basic e2eScenario * Build: Adds end to end tests to config * Build: Changes end to end job * Build: Adds browsers to image * Build: Adds failing test * Refactor: Adds first e2e-test scenario * Fix: Ignores test output in gitignore * Refactor: Adds compare screenshots ability * Refactor: Removes unnecessary code * Build: Removes jest-puppeteer * Fix: Replaces test snapshots * Refactor: Creates output dir if missing * Refactor: Changes aria-labels to be more consistent * Docs: Adds section about end to end tests * Fix: Fixes snapshots * Docs: Adds information about ENV variables
38 lines
858 B
TypeScript
38 lines
858 B
TypeScript
// Libraries
|
|
import React, { FunctionComponent } from 'react';
|
|
|
|
// Components
|
|
import { Tooltip } from '@grafana/ui';
|
|
|
|
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={`${tooltip} navbar button`}
|
|
>
|
|
<i className={icon} />
|
|
</button>
|
|
</Tooltip>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<Tooltip content={tooltip}>
|
|
<a className={`btn navbar-button navbar-button--${classSuffix}`} href={href}>
|
|
<i className={icon} />
|
|
</a>
|
|
</Tooltip>
|
|
);
|
|
};
|