Commit 93ecf63e by Tobias Skarhed Committed by GitHub

InfoTooltip: Info icon with tooltip (#18478)

parent 993e5636
import React from 'react';
import { storiesOf } from '@storybook/react';
import { withCenteredStory } from '../../utils/storybook/withCenteredStory';
import { InfoTooltip } from './InfoTooltip';
const story = storiesOf('UI/Tooltip', module);
story.addDecorator(withCenteredStory);
story.add('InfoTooltip', () => <InfoTooltip>This is the content of the tooltip</InfoTooltip>);
import React from 'react';
import { Tooltip, TooltipProps } from '../Tooltip/Tooltip';
import { PopperContent } from '../Tooltip/PopperController';
interface InfoTooltipProps extends Omit<TooltipProps, 'children' | 'content'> {
children: PopperContent<any>;
}
export const InfoTooltip = ({ children, ...restProps }: InfoTooltipProps) => {
return (
<Tooltip content={children} {...restProps}>
<i className="fa fa-info-circle" />
</Tooltip>
);
};
...@@ -3,7 +3,7 @@ import * as PopperJS from 'popper.js'; ...@@ -3,7 +3,7 @@ import * as PopperJS from 'popper.js';
import { Popper } from './Popper'; import { Popper } from './Popper';
import { PopperController, UsingPopperProps } from './PopperController'; import { PopperController, UsingPopperProps } from './PopperController';
interface TooltipProps extends UsingPopperProps { export interface TooltipProps extends UsingPopperProps {
theme?: 'info' | 'error'; theme?: 'info' | 'error';
} }
export const Tooltip = ({ children, theme, ...controllerProps }: TooltipProps) => { export const Tooltip = ({ children, theme, ...controllerProps }: TooltipProps) => {
......
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