2022-09-28 21:46:29 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Box from '../../ui/box';
|
|
|
|
import Typography from '../../ui/typography';
|
|
|
|
import Tooltip from '../../ui/tooltip';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
TextColor,
|
2022-09-28 21:46:29 +02:00
|
|
|
DISPLAY,
|
2023-02-02 21:15:26 +01:00
|
|
|
TypographyVariant,
|
2022-09-28 21:46:29 +02:00
|
|
|
} from '../../../helpers/constants/design-system';
|
2023-02-23 22:20:07 +01:00
|
|
|
import { Icon, ICON_NAMES, ICON_SIZES } from '../../component-library';
|
2022-09-28 21:46:29 +02:00
|
|
|
|
|
|
|
export const CustomSpendingCapTooltip = ({
|
|
|
|
tooltipContentText,
|
|
|
|
tooltipIcon,
|
|
|
|
}) => (
|
|
|
|
<Box display={DISPLAY.INLINE_BLOCK}>
|
|
|
|
<Tooltip
|
|
|
|
interactive
|
|
|
|
position="top"
|
|
|
|
html={
|
|
|
|
<Typography
|
2023-02-02 21:15:26 +01:00
|
|
|
variant={TypographyVariant.H7}
|
2022-09-28 21:46:29 +02:00
|
|
|
margin={3}
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.textAlternative}
|
2022-09-28 21:46:29 +02:00
|
|
|
className="form-field__heading-title__tooltip"
|
|
|
|
>
|
|
|
|
{tooltipContentText}
|
|
|
|
</Typography>
|
|
|
|
}
|
|
|
|
>
|
|
|
|
{tooltipIcon ? (
|
2023-02-23 22:20:07 +01:00
|
|
|
<Icon
|
|
|
|
name={ICON_NAMES.DANGER}
|
|
|
|
className="form-field__heading-title__tooltip__warning-icon"
|
|
|
|
size={ICON_SIZES.AUTO}
|
|
|
|
style={{ 'vertical-align': 'bottom' }}
|
|
|
|
/>
|
2022-09-28 21:46:29 +02:00
|
|
|
) : (
|
2023-02-22 23:45:07 +01:00
|
|
|
tooltipIcon !== '' && <Icon name={ICON_NAMES.QUESTION} />
|
2022-09-28 21:46:29 +02:00
|
|
|
)}
|
|
|
|
</Tooltip>
|
|
|
|
</Box>
|
|
|
|
);
|
|
|
|
|
|
|
|
CustomSpendingCapTooltip.propTypes = {
|
|
|
|
tooltipContentText: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
|
|
tooltipIcon: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
|
|
|
|
};
|