import React, { FC, useContext } from 'react'; import { css } from 'emotion'; import { PluginState, Tooltip, ThemeContext } from '@grafana/ui'; import { PopperContent } from '@grafana/ui/src/components/Tooltip/PopperController'; interface Props { state?: PluginState; } function getPluginStateInfoText(state?: PluginState): PopperContent | null { switch (state) { case PluginState.alpha: return (
Alpha Plugin

This plugin is a work in progress and updates may include breaking changes.

); case PluginState.beta: return (
Beta Plugin

There could be bugs and minor breaking changes to this plugin.

); } return null; } const PluginStateinfo: FC = props => { const text = getPluginStateInfoText(props.state); if (!text) { return null; } const theme = useContext(ThemeContext); const styles = css` background: linear-gradient(to bottom, ${theme.colors.blueBase}, ${theme.colors.blueShade}); color: ${theme.colors.gray7}; white-space: nowrap; border-radius: 3px; text-shadow: none; font-size: 13px; padding: 4px 8px; margin-left: 16px; cursor: help; `; return (
{props.state}
); }; export default PluginStateinfo;