diff --git a/ui/components/app/edit-gas-fee-popover/network-statistics/tooltips.js b/ui/components/app/edit-gas-fee-popover/network-statistics/tooltips.js index f626959bd..1e5a409d7 100644 --- a/ui/components/app/edit-gas-fee-popover/network-statistics/tooltips.js +++ b/ui/components/app/edit-gas-fee-popover/network-statistics/tooltips.js @@ -11,7 +11,7 @@ import { } from '../../../../helpers/constants/design-system'; const NetworkStatusTooltip = ({ children, html, title }) => ( - + {children} diff --git a/ui/components/ui/info-tooltip/index.scss b/ui/components/ui/info-tooltip/index.scss index 28beeebfc..7b4ed32fb 100644 --- a/ui/components/ui/info-tooltip/index.scss +++ b/ui/components/ui/info-tooltip/index.scss @@ -11,58 +11,10 @@ } } -.tippy-popper[x-placement^=top] .tippy-tooltip-info-theme [x-arrow], -.tippy-popper[x-placement^=top] .tippy-tooltip-wideInfo-theme [x-arrow] { - border-top-color: var(--color-background-default); -} - -.tippy-popper[x-placement^=right] .tippy-tooltip-info-theme [x-arrow], -.tippy-popper[x-placement^=right] .tippy-tooltip-wideInfo-theme [x-arrow] { - border-right-color: var(--color-background-default); -} - -.tippy-popper[x-placement^=left] .tippy-tooltip-info-theme [x-arrow], -.tippy-popper[x-placement^=left] .tippy-tooltip-wideInfo-theme [x-arrow] { - border-left-color: var(--color-background-default); -} - -.tippy-popper[x-placement^=bottom] .tippy-tooltip-info-theme [x-arrow], -.tippy-popper[x-placement^=bottom] .tippy-tooltip-wideInfo-theme [x-arrow] { - border-bottom-color: var(--color-background-default); -} - .tippy-tooltip { - &#{&}-info-theme, - &#{&}-wideInfo-theme { - background: var(--color-background-default); - color: var(--color-text-default); - box-shadow: 0 0 14px rgba(0, 0, 0, 0.18); - border-radius: 8px; - max-width: 203px; + &#{&}-info-theme { + max-width: 200px; padding: 16px; - padding-bottom: 15px; - - .tippy-tooltip-content { - @include H7; - - text-align: left; - color: var(--color-text-alternative); - - a { - color: var(--color-primary-default); - } - - p { - margin-bottom: 12px; - - &:last-child { - margin-bottom: 0; - } - } - } - } - - &#{&}-wideInfo-theme { - max-width: 260px; + padding-bottom: 16px; } } diff --git a/ui/components/ui/info-tooltip/info-tooltip.js b/ui/components/ui/info-tooltip/info-tooltip.js index 2100b7cb1..0294636d0 100644 --- a/ui/components/ui/info-tooltip/info-tooltip.js +++ b/ui/components/ui/info-tooltip/info-tooltip.js @@ -16,7 +16,6 @@ export default function InfoTooltip({ position = '', containerClassName, wrapperClassName, - wide, iconFillColor = 'var(--color-icon-alternative)', }) { return ( @@ -32,7 +31,7 @@ export default function InfoTooltip({ tooltipInnerClassName="info-tooltip__tooltip-content" tooltipArrowClassName={positionArrowClassMap[position]} html={contentText} - theme={wide ? 'tippy-tooltip-wideInfo' : 'tippy-tooltip-info'} + theme="tippy-tooltip-info" > @@ -49,10 +48,6 @@ InfoTooltip.propTypes = { * Shows position of the tooltip */ position: PropTypes.oneOf(['top', 'left', 'bottom', 'right']), - /** - * Set if the tooltip wide - */ - wide: PropTypes.bool, /** * Add custom CSS class for container */ diff --git a/ui/components/ui/info-tooltip/info-tooltip.stories.js b/ui/components/ui/info-tooltip/info-tooltip.stories.js index c77580bf6..c7c050e9b 100644 --- a/ui/components/ui/info-tooltip/info-tooltip.stories.js +++ b/ui/components/ui/info-tooltip/info-tooltip.stories.js @@ -17,7 +17,6 @@ export default { control: 'select', options: ['top', 'left', 'bottom', 'right'], }, - wide: { control: 'boolean' }, containerClassName: { control: 'text' }, wrapperClassName: { control: 'text' }, iconFillColor: { control: 'text' }, diff --git a/ui/components/ui/tooltip/index.scss b/ui/components/ui/tooltip/index.scss index fe1e5819a..2b2946ac7 100644 --- a/ui/components/ui/tooltip/index.scss +++ b/ui/components/ui/tooltip/index.scss @@ -1,30 +1,44 @@ -.tippy-tooltip.white-theme { - background: var(--color-background-default); - color: var(--color-text-default); - box-shadow: 0 0 14px rgba(0, 0, 0, 0.18); - padding: 12px 16px; - padding-bottom: 11px; +.tippy-popper { + .tippy-tooltip.tippy-tooltip--mm-custom-theme { + background: var(--color-background-default); + color: var(--color-text-default); + box-shadow: 0 0 14px rgba(0, 0, 0, 0.18); + padding: 12px 16px; + padding-bottom: 11px; - .tippy-tooltip-content { - @include H7; + .tippy-tooltip-content { + @include H7; - text-align: left; - color: var(--color-text-alternative); + text-align: left; + color: var(--color-text-alternative); + + a { + color: var(--color-primary-default); + } + + p { + margin-bottom: 16px; + + &:last-child { + margin-bottom: 0; + } + } + } + } + + &[x-placement^=top] .tippy-tooltip.tippy-tooltip--mm-custom-theme [x-arrow] { + border-top-color: var(--color-background-default); + } + + &[x-placement^=right] .tippy-tooltip.tippy-tooltip--mm-custom-theme [x-arrow] { + border-right-color: var(--color-background-default); + } + + &[x-placement^=left] .tippy-tooltip.tippy-tooltip--mm-custom-theme [x-arrow] { + border-left-color: var(--color-background-default); + } + + &[x-placement^=bottom] .tippy-tooltip.tippy-tooltip--mm-custom-theme [x-arrow] { + border-bottom-color: var(--color-background-default); } } - -.tippy-popper[x-placement^=top] .white-theme [x-arrow] { - border-top-color: var(--color-background-default); -} - -.tippy-popper[x-placement^=right] .white-theme [x-arrow] { - border-right-color: var(--color-background-default); -} - -.tippy-popper[x-placement^=left] .white-theme [x-arrow] { - border-left-color: var(--color-background-default); -} - -.tippy-popper[x-placement^=bottom] .white-theme [x-arrow] { - border-bottom-color: var(--color-background-default); -} diff --git a/ui/components/ui/tooltip/tooltip.js b/ui/components/ui/tooltip/tooltip.js index 84afe57ed..b05a0acf1 100644 --- a/ui/components/ui/tooltip/tooltip.js +++ b/ui/components/ui/tooltip/tooltip.js @@ -82,7 +82,7 @@ export default class Tooltip extends PureComponent { style={style} title={disabled ? '' : title} trigger={trigger} - theme={theme} + theme={`tippy-tooltip--mm-custom ${theme}`} // Required for correct theming tabIndex={tabIndex || 0} tag={tag} > diff --git a/ui/components/ui/tooltip/tooltip.stories.js b/ui/components/ui/tooltip/tooltip.stories.js new file mode 100644 index 000000000..cd60685a4 --- /dev/null +++ b/ui/components/ui/tooltip/tooltip.stories.js @@ -0,0 +1,92 @@ +import React from 'react'; +import Box from '../box/box'; +import Typography from '../typography/typography'; +import Tooltip from '.'; + +export default { + title: 'Components/UI/Tooltip', + id: __filename, + argTypes: { + containerClassName: { + control: 'text', + }, + disabled: { + control: 'boolean', + }, + html: { + control: 'html', + }, + interactive: { + control: 'boolean', + }, + onHidden: { + action: 'onHidden', + }, + position: { + control: 'select', + options: ['top', 'right', 'bottom', 'left'], + }, + size: { + control: 'select', + options: ['small', 'regular', 'big'], + }, + title: { + control: 'text', + }, + trigger: { + control: 'any', + }, + wrapperClassName: { + control: 'text', + }, + style: { + control: 'object', + }, + tabIndex: { + control: 'number', + }, + tag: { + control: 'text', + }, + }, + args: { + position: 'top', + title: 'Title of the tooltip', + trigger: 'mouseenter', + }, +}; + +export const DefaultStory = (args) => ( + + Hover over the info icon to see the tooltip + + + + +); + +DefaultStory.storyName = 'Default'; + +export const HTML = (args) => ( + + This tooltips content is html + + + + +); + +HTML.args = { + interactive: true, + html: ( + + And includes a link + + ), +}; diff --git a/ui/pages/swaps/fee-card/fee-card.js b/ui/pages/swaps/fee-card/fee-card.js index 28d7a0131..dfb6d9d5a 100644 --- a/ui/pages/swaps/fee-card/fee-card.js +++ b/ui/pages/swaps/fee-card/fee-card.js @@ -109,7 +109,6 @@ export default function FeeCard({ } containerClassName="fee-card__info-tooltip-content-container" wrapperClassName="fee-card__row-label fee-card__info-tooltip-container" - wide /> } diff --git a/ui/pages/swaps/main-quote-summary/main-quote-summary.js b/ui/pages/swaps/main-quote-summary/main-quote-summary.js index 990a9276f..33a1f8fdc 100644 --- a/ui/pages/swaps/main-quote-summary/main-quote-summary.js +++ b/ui/pages/swaps/main-quote-summary/main-quote-summary.js @@ -93,7 +93,6 @@ export default function MainQuoteSummary({ position="bottom" html={amountToDisplay} disabled={ellipsedAmountToDisplay === amountToDisplay} - theme="white" > {priceDifferenceTitle} - +