Redesign Tooltip component

This commit is contained in:
Amine Ben hammou
2020-06-29 22:00:47 +02:00
committed by Veljko V
parent a181afe646
commit 0fb3375a01
7 changed files with 74 additions and 8 deletions

View File

@@ -0,0 +1,34 @@
import React from 'react';
import Heading from 'common/typography/heading/heading';
import Tooltip from '../tooltip';
export default {
title: 'Tooltips',
};
export const Tooltips = () => (
<>
<Heading level={1}>Placements</Heading>
<div style={{ display: 'flex', justifyContent: 'space-around' }}>
<p data-tip data-for="bottom">Bottom Tooltip</p>
<Tooltip id="bottom" place="bottom">
<span>The tooltip content</span>
</Tooltip>
<p data-tip data-for="top">Top Tooltip</p>
<Tooltip id="top" place="top">
<span>The tooltip content</span>
</Tooltip>
<p data-tip data-for="right">Right Tooltip</p>
<Tooltip id="right" place="right">
<span>The tooltip content</span>
</Tooltip>
<p data-tip data-for="left">Left Tooltip</p>
<Tooltip id="left" place="left">
<span>The tooltip content</span>
</Tooltip>
</div>
</>
);

View File

@@ -0,0 +1,21 @@
import React from 'react';
import classNames from 'classnames';
import ReactTooltip, { TooltipProps } from 'react-tooltip';
const Tooltip = ({
effect, textColor, backgroundColor, border, borderColor, className, children, ...props
}: TooltipProps) => (
<ReactTooltip
effect={effect || 'solid'}
textColor={textColor || '#071c6d'}
backgroundColor={backgroundColor || '#fafbfe'}
borderColor={borderColor || '#e5e9f8'}
className={classNames('mailpoet-tooltip', className)}
border={border === undefined ? true : border}
{...props}
>
{children}
</ReactTooltip>
);
export default Tooltip;