Skip to content

Commit 06ad7bb

Browse files
KEEP-1182: fix profit block on swap screen
1 parent 6a648ab commit 06ad7bb

File tree

3 files changed

+31
-11
lines changed

3 files changed

+31
-11
lines changed

src/ui/components/pages/swap/form.module.css

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@
143143
position: absolute;
144144
top: -8px;
145145
left: -1px;
146-
padding: 1px 8px;
146+
padding: 1px 22px 1px 8px;
147147
border-radius: 4px;
148148
border-bottom-left-radius: 0;
149149
background: #0155ff;
@@ -152,6 +152,15 @@
152152
font-weight: bold;
153153
}
154154

155+
.profitInfoIcon {
156+
position: absolute;
157+
top: 1px;
158+
right: 4px;
159+
display: flex;
160+
width: 14px;
161+
fill: currentColor;
162+
}
163+
155164
.slippageToleranceBtn {
156165
margin-right: 8px;
157166
vertical-align: bottom;

src/ui/components/pages/swap/form.tsx

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import { Select } from 'ui/components/ui/select/Select';
2727
import { Tooltip } from 'ui/components/ui/tooltip';
2828
import { UsdAmount } from 'ui/components/ui/UsdAmount';
2929

30+
import { InfoIcon } from '../../../../icons/info';
3031
import * as styles from './form.module.css';
3132
import { SwapLayout } from './layout';
3233

@@ -702,22 +703,32 @@ export function SwapForm({
702703
<div className={styles.toAmountCardBadge}>
703704
{profitTokens != null && !profitTokens.eq(0) ? (
704705
<>
705-
{t('swap.profitLabel')}: +
706-
{profitTokens.toFixed(
707-
toAsset.precision,
708-
BigNumber.ROUND_MODE.ROUND_FLOOR
709-
)}{' '}
710-
{toAsset.displayName}
706+
{t('swap.profitLabel')}:
711707
{usdPrice && usdPrice !== '1' && (
712708
<>
713709
{' '}
714-
(≈ $
710+
$
715711
{new BigNumber(usdPrice)
716712
.mul(profitTokens)
717713
.toFixed(2)}
718-
)
719714
</>
720-
)}
715+
)}{' '}
716+
<Tooltip
717+
content={`${profitTokens.toFixed(
718+
toAsset.precision,
719+
BigNumber.ROUND_MODE.ROUND_FLOOR
720+
)} ${toAsset.displayName}`}
721+
placement="top"
722+
>
723+
{props => (
724+
<span
725+
{...props}
726+
className={styles.profitInfoIcon}
727+
>
728+
<InfoIcon />
729+
</span>
730+
)}
731+
</Tooltip>
721732
</>
722733
) : (
723734
t('swap.primaryLabel')

src/ui/components/ui/tooltip/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ interface Props {
1414
ref: React.MutableRefObject<any>;
1515
onMouseEnter: () => void;
1616
onMouseLeave: () => void;
17-
}) => React.ReactChild;
17+
}) => React.ReactNode;
1818
content: React.ReactNode;
1919
placement?: Placement;
2020
}

0 commit comments

Comments
 (0)