Commit 71d0fae3 by Torkel Ödegaard

Progress on tooltip style update

parent 0e2310de
import React, { FunctionComponent, ReactNode } from 'react';
import classNames from 'classnames';
import { Tooltip } from '..';
import { Tooltip } from '../Tooltip/Tooltip';
interface Props {
children: ReactNode;
......@@ -31,9 +31,9 @@ export const FormLabel: FunctionComponent<Props> = ({
<label className={classes} {...rest} htmlFor={htmlFor}>
{children}
{tooltip && (
<Tooltip placement="auto" content={tooltip}>
<div className="gf-form-help-icon--right-normal">
<i className="gicon gicon-question gicon--has-hover" />
<Tooltip placement="top" content={tooltip} theme={"info"}>
<div className="gf-form-help-icon gf-form-help-icon--right-normal">
<i className="fa fa-info-circle" />
</div>
</Tooltip>
)}
......
import React, { createRef } from 'react';
import React, { createRef } from 'react';
import * as PopperJS from 'popper.js';
import Popper from './Popper';
import PopperController, { UsingPopperProps } from './PopperController';
export enum Themes {
Default = 'popper__background--default',
Error = 'popper__background--error',
Brand = 'popper__background--brand',
}
interface TooltipProps extends UsingPopperProps {
theme?: Themes;
theme?: 'info' | 'error';
}
export const Tooltip = ({ children, theme, ...controllerProps }: TooltipProps) => {
const tooltipTriggerRef = createRef<PopperJS.ReferenceObject>();
const popperBackgroundClassName = 'popper__background' + (theme ? ' ' + theme : '');
const popperBackgroundClassName = 'popper__background' + (theme ? ' popper__background--' + theme : '');
return (
<PopperController {...controllerProps}>
......
$popper-margin-from-ref: 5px;
@mixin popper-theme($backgroundColor, $arrowColor) {
@mixin popper-theme($backgroundColor, $textColor) {
background: $backgroundColor;
color: $textColor;
.popper__arrow {
border-color: $arrowColor;
border-color: $backgroundColor;
}
}
......@@ -19,7 +21,7 @@ $popper-margin-from-ref: 5px;
background: $tooltipBackground;
border-radius: $border-radius-sm;
box-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
padding: 4px 8px;
padding: 6px 10px;
color: $tooltipColor;
font-weight: 500;
......@@ -32,10 +34,9 @@ $popper-margin-from-ref: 5px;
@include popper-theme($tooltipBackgroundError, $tooltipBackgroundError);
}
/*&.popper__background--brand {
@include popper-theme($tooltipBackgroundBrand, $tooltipBackgroundBrand);
@include gradient-vertical($tooltipBackground, $tooltipBackground);
}*/
&.popper__background--info {
@include popper-theme($popover-help-bg, $popover-help-color);
}
}
.popper__arrow {
......
......@@ -37,7 +37,7 @@
<i class="fa fa-link"></i>
</a>
<button class="btn navbar-button navbar-button--settings" ng-click="ctrl.toggleSettings()" bs-tooltip="'Settings'" data-placement="bottom" ng-show="ctrl.dashboard.meta.showSettings">
<button class="btn navbar-button navbar-button--settings" ng-click="ctrl.toggleSettings()" bs-tooltip="'Dashboard Settings'" data-placement="bottom" ng-show="ctrl.dashboard.meta.showSettings">
<i class="fa fa-cog"></i>
</button>
</div>
......
// Library
import React, { Component } from 'react';
import { Tooltip } from '@grafana/ui';
import { Themes } from '@grafana/ui/src/components/Tooltip/Tooltip';
import ErrorBoundary from 'app/core/components/ErrorBoundary/ErrorBoundary';
......@@ -200,7 +199,7 @@ export class DataPanel extends Component<Props, State> {
);
} else if (loading === LoadingState.Error) {
return (
<Tooltip content={errorMessage} placement="bottom-start" theme={Themes.Error}>
<Tooltip content={errorMessage} placement="bottom-start" theme="error">
<div className="panel-info-corner panel-info-corner--error">
<i className="fa" />
<span className="panel-info-corner-inner" />
......
import React, { FC } from 'react';
import { Tooltip } from '@grafana/ui';
import React, { FC } from 'react';
import { FormLabel } from '@grafana/ui';
interface Props {
label: string;
......@@ -11,9 +11,9 @@ interface Props {
}
export const DataSourceOptions: FC<Props> = ({ label, placeholder, name, value, onChange, tooltipInfo }) => {
const dsOption = (
return (
<div className="gf-form gf-form--flex-end">
<label className="gf-form-label">{label}</label>
<FormLabel tooltip={tooltipInfo}>{label}</FormLabel>
<input
type="text"
className="gf-form-input width-6"
......@@ -24,8 +24,6 @@ export const DataSourceOptions: FC<Props> = ({ label, placeholder, name, value,
/>
</div>
);
return tooltipInfo ? <Tooltip content={tooltipInfo}>{dsOption}</Tooltip> : dsOption;
};
export default DataSourceOptions;
......@@ -16,7 +16,6 @@ import { DashboardModel } from '../dashboard_model';
import { PanelPlugin } from 'app/types/plugins';
import { Tooltip } from '@grafana/ui';
import { Themes } from '@grafana/ui/src/components/Tooltip/Tooltip';
interface PanelEditorProps {
panel: PanelModel;
......@@ -139,7 +138,7 @@ function TabItem({ tab, activeTab, onClick }: TabItemParams) {
return (
<div className="panel-editor-tabs__item" onClick={() => onClick(tab)}>
<a className={tabClasses}>
<Tooltip content={`${tab.text}`} placement="auto" theme={Themes.Brand}>
<Tooltip content={`${tab.text}`} placement="auto">
<i className={`gicon gicon-${tab.id}${activeTab === tab.id ? '-active' : ''}`} />
</Tooltip>
</a>
......
......@@ -307,8 +307,8 @@ $tooltipArrowWidth: 5px;
$tooltipLinkColor: $link-color;
$graph-tooltip-bg: $dark-1;
$tooltipBackground: $gray-1;
$tooltipColor: $gray-6;
$tooltipBackground: $black;
$tooltipColor: $gray-4;
$tooltipArrowColor: $tooltipBackground;
$tooltipBackgroundError: $brand-danger;
$tooltipBackgroundBrand: $brand-primary;
......
......@@ -12,7 +12,7 @@
}
.gicon--has-hover {
opacity: 0.5;
opacity: 0.7;
&:hover {
opacity: 1;
......
......@@ -384,6 +384,10 @@ $input-border: 1px solid $input-border-color;
&--no-padding {
padding-left: 0;
}
&:hover {
color: $text-color;
}
}
select.gf-form-input ~ .gf-form-help-icon {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment