Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-79834 || Popover reuse settings #3301

Merged
merged 3 commits into from
Oct 18, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { defineMessages, injectIntl, useIntl } from 'react-intl';
import { defineMessages, injectIntl } from 'react-intl';
import track from 'react-tracking';
import classNames from 'classnames/bind';
import { fetch } from 'common/utils';
Expand All @@ -30,7 +30,7 @@ import {
COMMAND_GET_ISSUE_FIELDS,
} from 'controllers/plugins/uiExtensions/constants';
import { URLS } from 'common/urls';
import { withTooltip } from 'components/main/tooltips/tooltip';
import { withPopover } from 'componentLibrary/popover';
import Parser from 'html-react-parser';
import InfoIcon from 'common/img/newIcons/icon-about-inline.svg';
import { Dropdown } from 'componentLibrary/dropdown';
Expand Down Expand Up @@ -74,24 +74,32 @@ const messages = defineMessages({
},
});

const Tooltip = () => {
const { formatMessage } = useIntl();
return <div>{formatMessage(messages.tooltip)}</div>;
const Popover = ({ formatMessage }) => (
<div className={cx('popover')}>
<div className={cx('title')}>{formatMessage(messages.showFieldsHeader)}</div>
Vadim73i marked this conversation as resolved.
Show resolved Hide resolved
<span>{formatMessage(messages.tooltip)}</span>
</div>
);
Popover.propTypes = {
formatMessage: PropTypes.func.isRequired,
};

const IconShow = () => {
return <>{Parser(InfoIcon)}</>;
};

const ShowWithTooltip = withTooltip({
TooltipComponent: Tooltip,
data: {
dynamicWidth: true,
align: 'bottom',
noArrow: false,
dark: true,
const ShowWithTooltip = withPopover({
tr1ble marked this conversation as resolved.
Show resolved Hide resolved
ContentComponent: Popover,
side: 'bottom',
arrowPosition: 'middle',
popoverWrapperStyle: {
tr1ble marked this conversation as resolved.
Show resolved Hide resolved
display: 'inline-block',
verticalAlign: 'center',
},
})(IconShow);
ShowWithTooltip.propTypes = {
formatMessage: PropTypes.func.isRequired,
};

@connect(
(state) => ({
Expand Down Expand Up @@ -441,7 +449,7 @@ export class BtsPropertiesForIssueForm extends Component {
<span className={cx('show-hint-text')}>
{intl.formatMessage(messages.showFieldsHeader)}
</span>
<ShowWithTooltip />
<ShowWithTooltip formatMessage={intl.formatMessage} />
</div>
</div>
</Fragment>
Expand All @@ -461,7 +469,7 @@ export class BtsPropertiesForIssueForm extends Component {
<span className={cx('show-hint-text')}>
{intl.formatMessage(messages.showFieldsHeader)}
</span>
<ShowWithTooltip />
<ShowWithTooltip formatMessage={intl.formatMessage} />
</div>
)}
</DynamicFieldsSection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,20 @@
display: none;
}
}

.popover {
font-family: $FONT-ROBOTO-REGULAR;
font-style: normal;
font-weight: 400;
tr1ble marked this conversation as resolved.
Show resolved Hide resolved
font-size: 11px;
line-height: 16px;
color: $COLOR--almost-black;

.title {
margin-bottom: 8px;
font-family: $FONT-ROBOTO-MEDIUM;
font-size: 13px;
line-height: 20px;
text-indent: 1px;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import PencilIcon from 'common/img/newIcons/pencil-inline.svg';
import CopyIcon from 'common/img/newIcons/copy-inline.svg';
import LocatorIcon from 'common/img/newIcons/locator-icon-inline.svg';
import { COMMON_LOCALE_KEYS } from 'common/constants/localization';
import { withHoverableTooltip } from 'components/main/tooltips/hoverableTooltip';
import { withPopover } from 'componentLibrary/popover';
import { CopyToClipboard } from 'react-copy-to-clipboard';
import { showModalAction } from 'controllers/modal';
import { deleteDefectTypeAction, updateDefectTypeAction } from 'controllers/project';
Expand All @@ -36,7 +36,7 @@ import styles from './defectTypeRow.scss';

const cx = classNames.bind(styles);

const DefectLocatorTooltip = ({ locator }) => {
const DefectLocatorPopoverContent = ({ locator }) => {
const { trackEvent } = useTracking();

return (
Expand All @@ -56,15 +56,17 @@ const DefectLocatorTooltip = ({ locator }) => {
</div>
);
};
DefectLocatorTooltip.propTypes = {
DefectLocatorPopoverContent.propTypes = {
locator: PropTypes.string.isRequired,
};

const DefectLocator = withHoverableTooltip({
TooltipComponent: DefectLocatorTooltip,
data: {
placement: 'bottom',
dynamicWidth: true,
const DefectLocatorWithPopover = withPopover({
ContentComponent: DefectLocatorPopoverContent,
side: 'bottom',
arrowPosition: 'right',
popoverWrapperStyle: {
tr1ble marked this conversation as resolved.
Show resolved Hide resolved
display: 'inline-block',
verticalAlign: 'center',
},
})(() => (
<div className={cx('locator-wrapper')}>
Expand All @@ -73,7 +75,7 @@ const DefectLocator = withHoverableTooltip({
</i>
</div>
));
DefectLocator.propTypes = {
DefectLocatorWithPopover.propTypes = {
locator: PropTypes.string.isRequired,
};

Expand Down Expand Up @@ -157,7 +159,7 @@ export const DefectTypeRow = ({
)}
</div>
</div>
<DefectLocator locator={locator} />
<DefectLocatorWithPopover locator={locator} />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ $DEFECT_NAME_PADDING: 16px;

.defect-locator-tooltip {
tr1ble marked this conversation as resolved.
Show resolved Hide resolved
display: inline-flex;
margin-top: 4px;
font-size: 13px;
font-family: $FONT-ROBOTO-MEDIUM;
color: $COLOR--almost-black;
Expand Down