2022-09-28 21:46:29 +02:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import Box from '../../ui/box';
|
|
|
|
import Tooltip from '../../ui/tooltip';
|
|
|
|
import {
|
2023-02-02 21:15:26 +01:00
|
|
|
TextColor,
|
2023-04-24 17:52:57 +02:00
|
|
|
TextVariant,
|
2023-07-18 07:03:46 +02:00
|
|
|
Display,
|
2022-09-28 21:46:29 +02:00
|
|
|
} from '../../../helpers/constants/design-system';
|
2023-04-24 17:52:57 +02:00
|
|
|
|
2023-07-14 19:59:30 +02:00
|
|
|
import { Icon, IconName, IconSize } from '../../component-library';
|
|
|
|
import { Text } from '../../component-library/text/deprecated';
|
2022-09-28 21:46:29 +02:00
|
|
|
|
|
|
|
export const CustomSpendingCapTooltip = ({
|
|
|
|
tooltipContentText,
|
|
|
|
tooltipIcon,
|
|
|
|
}) => (
|
2023-07-18 07:03:46 +02:00
|
|
|
<Box display={Display.InlineBlock}>
|
2022-09-28 21:46:29 +02:00
|
|
|
<Tooltip
|
|
|
|
interactive
|
|
|
|
position="top"
|
|
|
|
html={
|
2023-04-24 17:52:57 +02:00
|
|
|
<Text
|
|
|
|
variant={TextVariant.bodySm}
|
|
|
|
as="h6"
|
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}
|
2023-04-24 17:52:57 +02:00
|
|
|
</Text>
|
2022-09-28 21:46:29 +02:00
|
|
|
}
|
|
|
|
>
|
|
|
|
{tooltipIcon ? (
|
2023-02-23 22:20:07 +01:00
|
|
|
<Icon
|
2023-04-19 23:16:49 +02:00
|
|
|
name={IconName.Danger}
|
2023-02-23 22:20:07 +01:00
|
|
|
className="form-field__heading-title__tooltip__warning-icon"
|
2023-04-24 16:19:19 +02:00
|
|
|
size={IconSize.Inherit}
|
2023-02-23 22:20:07 +01:00
|
|
|
style={{ 'vertical-align': 'bottom' }}
|
|
|
|
/>
|
2022-09-28 21:46:29 +02:00
|
|
|
) : (
|
2023-04-19 23:16:49 +02:00
|
|
|
tooltipIcon !== '' && (
|
|
|
|
<Icon name={IconName.Question} size={IconSize.Inherit} />
|
|
|
|
)
|
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]),
|
|
|
|
};
|