@rango-dev/ui 0.29.0 → 0.29.1-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +4 -4
- package/dist/widget/ui/src/components/Alert/Alert.types.d.ts +1 -1
- package/dist/widget/ui/src/components/Alert/Alert.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.d.ts +4 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.d.ts.map +1 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.stories.d.ts +7 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.stories.d.ts.map +1 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.styles.d.ts +3566 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.types.d.ts +18 -0
- package/dist/widget/ui/src/components/ExpandedRoute/ExpandedRoute.types.d.ts.map +1 -0
- package/dist/widget/ui/src/components/ExpandedRoute/index.d.ts +2 -0
- package/dist/widget/ui/src/components/ExpandedRoute/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/ExpandedRoute/mock.d.ts +7 -0
- package/dist/widget/ui/src/components/ExpandedRoute/mock.d.ts.map +1 -0
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.d.ts.map +1 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts +2 -1
- package/dist/widget/ui/src/components/PriceImpact/PriceImpact.types.d.ts.map +1 -1
- package/dist/widget/ui/src/components/QuoteTag/QuoteTag.d.ts +4 -0
- package/dist/widget/ui/src/components/QuoteTag/QuoteTag.d.ts.map +1 -0
- package/dist/widget/ui/src/components/QuoteTag/QuoteTag.styles.d.ts +327 -0
- package/dist/widget/ui/src/components/QuoteTag/QuoteTag.styles.d.ts.map +1 -0
- package/dist/widget/ui/src/components/QuoteTag/index.d.ts +2 -0
- package/dist/widget/ui/src/components/QuoteTag/index.d.ts.map +1 -0
- package/dist/widget/ui/src/components/index.d.ts +2 -1
- package/dist/widget/ui/src/components/index.d.ts.map +1 -1
- package/dist/widget/ui/src/types/index.d.ts +1 -0
- package/dist/widget/ui/src/types/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/components/Alert/Alert.types.ts +1 -1
- package/src/components/ExpandedRoute/ExpandedRoute.stories.tsx +29 -0
- package/src/components/ExpandedRoute/ExpandedRoute.styles.ts +186 -0
- package/src/components/ExpandedRoute/ExpandedRoute.tsx +147 -0
- package/src/components/ExpandedRoute/ExpandedRoute.types.ts +18 -0
- package/src/components/ExpandedRoute/index.ts +1 -0
- package/src/components/ExpandedRoute/mock.ts +236 -0
- package/src/components/PriceImpact/PriceImpact.tsx +5 -7
- package/src/components/PriceImpact/PriceImpact.types.ts +2 -1
- package/src/components/QuoteTag/QuoteTag.styles.ts +44 -0
- package/src/components/QuoteTag/QuoteTag.tsx +19 -0
- package/src/components/QuoteTag/index.ts +1 -0
- package/src/components/index.ts +2 -1
- package/src/containers/SwapInput/SwapInput.tsx +1 -1
- package/src/types/index.ts +4 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { css, darkTheme, styled } from '../../theme';
|
|
2
|
+
import { PriceImpact } from '../PriceImpact';
|
|
3
|
+
|
|
4
|
+
export const tokenLabelStyles = css({});
|
|
5
|
+
|
|
6
|
+
const FlexCenter = styled('div', {
|
|
7
|
+
display: 'flex',
|
|
8
|
+
justifyContent: 'center',
|
|
9
|
+
alignItems: 'center',
|
|
10
|
+
});
|
|
11
|
+
export const RouteContainer = styled('div', {
|
|
12
|
+
border: '1px solid',
|
|
13
|
+
padding: '$20 $15',
|
|
14
|
+
backgroundColor: '$neutral200',
|
|
15
|
+
borderRadius: '$xm',
|
|
16
|
+
cursor: 'pointer',
|
|
17
|
+
gap: '$20',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
[`.${darkTheme} &`]: {
|
|
21
|
+
backgroundColor: '$neutral500',
|
|
22
|
+
},
|
|
23
|
+
variants: {
|
|
24
|
+
selected: {
|
|
25
|
+
true: {
|
|
26
|
+
$$color: '$colors$secondary500',
|
|
27
|
+
[`.${darkTheme} &`]: {
|
|
28
|
+
$$color: '$colors$secondary400',
|
|
29
|
+
},
|
|
30
|
+
borderColor: '$$color',
|
|
31
|
+
},
|
|
32
|
+
false: {
|
|
33
|
+
borderColor: 'transparent',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
export const RouteHeader = styled('div', {
|
|
40
|
+
display: 'flex',
|
|
41
|
+
justifyContent: 'space-between',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export const TagsContainer = styled('div', {
|
|
45
|
+
display: 'flex',
|
|
46
|
+
gap: '$5',
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const Steps = styled('div', {
|
|
50
|
+
display: 'flex',
|
|
51
|
+
height: '85px',
|
|
52
|
+
padding: '$2',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const Step = styled('div', {
|
|
56
|
+
padding: '$2',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
width: '100%',
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const LeftSection = styled(FlexCenter, {
|
|
62
|
+
minWidth: '42px',
|
|
63
|
+
position: 'relative',
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
export const RightSection = styled('div', {
|
|
67
|
+
width: '100%',
|
|
68
|
+
height: '50%',
|
|
69
|
+
borderBottom: '1px dashed',
|
|
70
|
+
borderColor: '$info300',
|
|
71
|
+
display: 'flex',
|
|
72
|
+
flexDirection: 'column',
|
|
73
|
+
gap: '2px',
|
|
74
|
+
[`.${darkTheme} &`]: {
|
|
75
|
+
borderColor: '$secondary600',
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export const FromToken = styled(FlexCenter, {
|
|
80
|
+
position: 'absolute',
|
|
81
|
+
flexDirection: 'column',
|
|
82
|
+
bottom: 0,
|
|
83
|
+
left: 0,
|
|
84
|
+
right: 0,
|
|
85
|
+
[`& .${tokenLabelStyles}`]: {
|
|
86
|
+
color: '$neutral700',
|
|
87
|
+
[`.${darkTheme} &`]: {
|
|
88
|
+
color: '$neutral900',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
export const SwapperContainer = styled(FlexCenter, {
|
|
94
|
+
flexDirection: 'column',
|
|
95
|
+
'& ._typography': {
|
|
96
|
+
color: '$neutral700',
|
|
97
|
+
[`.${darkTheme} &`]: {
|
|
98
|
+
color: '$neutral900',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export const SwapperImage = styled(FlexCenter, {
|
|
104
|
+
borderRadius: '$lg',
|
|
105
|
+
position: 'relative',
|
|
106
|
+
width: '$18',
|
|
107
|
+
height: '$18',
|
|
108
|
+
border: '1px solid transparent',
|
|
109
|
+
variants: {
|
|
110
|
+
state: {
|
|
111
|
+
warning: {
|
|
112
|
+
borderColor: '$warning500',
|
|
113
|
+
},
|
|
114
|
+
error: {
|
|
115
|
+
borderColor: '$error500',
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
export const IconHighlight = styled(FlexCenter, {
|
|
122
|
+
borderRadius: '$lg',
|
|
123
|
+
position: 'absolute',
|
|
124
|
+
width: '$8',
|
|
125
|
+
height: '$8',
|
|
126
|
+
bottom: -2,
|
|
127
|
+
right: -2,
|
|
128
|
+
variants: {
|
|
129
|
+
type: {
|
|
130
|
+
warning: {
|
|
131
|
+
$$color: '$colors$warning300',
|
|
132
|
+
[`.${darkTheme} &`]: {
|
|
133
|
+
$$color: '$colors$warning600',
|
|
134
|
+
},
|
|
135
|
+
backgroundColor: '$$color',
|
|
136
|
+
},
|
|
137
|
+
error: {
|
|
138
|
+
$$color: '$colors$error300',
|
|
139
|
+
[`.${darkTheme} &`]: {
|
|
140
|
+
$$color: '$colors$error600',
|
|
141
|
+
},
|
|
142
|
+
backgroundColor: '$$color',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export const OutputSection = styled(FlexCenter, {
|
|
149
|
+
flexDirection: 'column',
|
|
150
|
+
paddingLeft: '$4',
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
export const VerticalLine = styled('div', {
|
|
154
|
+
display: 'flex',
|
|
155
|
+
width: '50%',
|
|
156
|
+
borderRight: '1px dashed',
|
|
157
|
+
height: '$10',
|
|
158
|
+
borderColor: '$info300',
|
|
159
|
+
[`.${darkTheme} &`]: {
|
|
160
|
+
borderColor: '$secondary600',
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
export const StyledPriceImpact = styled(PriceImpact, {
|
|
165
|
+
justifyContent: 'center',
|
|
166
|
+
gap: '$4',
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
export const lastStepStyle = css({
|
|
170
|
+
position: 'relative',
|
|
171
|
+
'&::after': {
|
|
172
|
+
content: '',
|
|
173
|
+
position: 'absolute',
|
|
174
|
+
top: '50%',
|
|
175
|
+
right: '0',
|
|
176
|
+
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
177
|
+
width: '$6',
|
|
178
|
+
height: '$6',
|
|
179
|
+
borderTop: '2px solid',
|
|
180
|
+
borderRight: '2px solid',
|
|
181
|
+
borderColor: '$info300',
|
|
182
|
+
[`.${darkTheme} &`]: {
|
|
183
|
+
borderColor: '$secondary600',
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
});
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import type { PropTypes } from './ExpandedRoute.types';
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
import { ErrorIcon, WarningIcon } from '../../icons';
|
|
6
|
+
import { ChainToken } from '../ChainToken';
|
|
7
|
+
import { Image } from '../common';
|
|
8
|
+
import { Divider } from '../Divider';
|
|
9
|
+
import { QuoteCost } from '../QuoteCost';
|
|
10
|
+
import { QuoteTag } from '../QuoteTag';
|
|
11
|
+
import { Tooltip } from '../Tooltip';
|
|
12
|
+
import { Typography } from '../Typography';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
FromToken,
|
|
16
|
+
IconHighlight,
|
|
17
|
+
lastStepStyle,
|
|
18
|
+
LeftSection,
|
|
19
|
+
OutputSection,
|
|
20
|
+
RightSection,
|
|
21
|
+
RouteContainer,
|
|
22
|
+
RouteHeader,
|
|
23
|
+
Step,
|
|
24
|
+
Steps,
|
|
25
|
+
StyledPriceImpact,
|
|
26
|
+
SwapperContainer,
|
|
27
|
+
SwapperImage,
|
|
28
|
+
TagsContainer,
|
|
29
|
+
tokenLabelStyles,
|
|
30
|
+
VerticalLine,
|
|
31
|
+
} from './ExpandedRoute.styles';
|
|
32
|
+
|
|
33
|
+
export function ExpandedRoute(props: PropTypes) {
|
|
34
|
+
const {
|
|
35
|
+
steps,
|
|
36
|
+
tags,
|
|
37
|
+
time,
|
|
38
|
+
fee,
|
|
39
|
+
percentageChange,
|
|
40
|
+
warningLevel,
|
|
41
|
+
outputPrice,
|
|
42
|
+
tooltipContainer,
|
|
43
|
+
selected = false,
|
|
44
|
+
onClick,
|
|
45
|
+
} = props;
|
|
46
|
+
const numberOfSteps = steps.length;
|
|
47
|
+
return (
|
|
48
|
+
<RouteContainer selected={selected} onClick={onClick}>
|
|
49
|
+
<RouteHeader>
|
|
50
|
+
<QuoteCost fee={fee} time={time} steps={numberOfSteps} />
|
|
51
|
+
<TagsContainer>
|
|
52
|
+
{tags.map((tag) => (
|
|
53
|
+
<QuoteTag key={tag.label} label={tag.label} value={tag.value} />
|
|
54
|
+
))}
|
|
55
|
+
</TagsContainer>
|
|
56
|
+
</RouteHeader>
|
|
57
|
+
<Steps>
|
|
58
|
+
{steps.map((step, index) => {
|
|
59
|
+
const key = `item-${index}`;
|
|
60
|
+
return (
|
|
61
|
+
<Step
|
|
62
|
+
key={key}
|
|
63
|
+
className={index === numberOfSteps - 1 ? lastStepStyle() : ''}>
|
|
64
|
+
<LeftSection>
|
|
65
|
+
<ChainToken
|
|
66
|
+
size="small"
|
|
67
|
+
chainImage={step.from.chain.image}
|
|
68
|
+
tokenImage={step.from.token.image}
|
|
69
|
+
/>
|
|
70
|
+
<FromToken>
|
|
71
|
+
<Tooltip
|
|
72
|
+
content={step.from.price.realValue}
|
|
73
|
+
container={tooltipContainer}
|
|
74
|
+
side="bottom"
|
|
75
|
+
open={!step.from.price.realValue ? false : undefined}>
|
|
76
|
+
<Typography size="xsmall" variant="body">
|
|
77
|
+
{step.from.price.value}
|
|
78
|
+
</Typography>
|
|
79
|
+
</Tooltip>
|
|
80
|
+
<Typography
|
|
81
|
+
size="xsmall"
|
|
82
|
+
variant="body"
|
|
83
|
+
className={tokenLabelStyles()}>
|
|
84
|
+
{step.from.token.displayName}
|
|
85
|
+
</Typography>
|
|
86
|
+
</FromToken>
|
|
87
|
+
</LeftSection>
|
|
88
|
+
<RightSection>
|
|
89
|
+
<SwapperContainer>
|
|
90
|
+
<SwapperImage state={step.state}>
|
|
91
|
+
<Image size={15} type="circular" src={step.swapper.image} />
|
|
92
|
+
{step.state && (
|
|
93
|
+
<IconHighlight type={step.state}>
|
|
94
|
+
{step.state === 'error' ? (
|
|
95
|
+
<ErrorIcon size={6} color="error" />
|
|
96
|
+
) : (
|
|
97
|
+
<WarningIcon size={6} color="warning" />
|
|
98
|
+
)}
|
|
99
|
+
</IconHighlight>
|
|
100
|
+
)}
|
|
101
|
+
</SwapperImage>
|
|
102
|
+
<Typography size="xsmall" variant="body" align="center">
|
|
103
|
+
{step.swapper.displayName}
|
|
104
|
+
</Typography>
|
|
105
|
+
</SwapperContainer>
|
|
106
|
+
<VerticalLine />
|
|
107
|
+
</RightSection>
|
|
108
|
+
</Step>
|
|
109
|
+
);
|
|
110
|
+
})}
|
|
111
|
+
<OutputSection>
|
|
112
|
+
<ChainToken
|
|
113
|
+
chainImage={steps[numberOfSteps - 1].to.chain.image}
|
|
114
|
+
tokenImage={steps[numberOfSteps - 1].to.token.image}
|
|
115
|
+
size="medium"
|
|
116
|
+
/>
|
|
117
|
+
<div>
|
|
118
|
+
<div>
|
|
119
|
+
<Tooltip
|
|
120
|
+
content={outputPrice.realValue}
|
|
121
|
+
container={tooltipContainer}
|
|
122
|
+
open={!outputPrice.realValue ? false : undefined}>
|
|
123
|
+
<Typography size="xmedium" variant="title">
|
|
124
|
+
{outputPrice.value}
|
|
125
|
+
</Typography>
|
|
126
|
+
<Divider size={4} direction="horizontal" />
|
|
127
|
+
<Typography size="large" variant="body">
|
|
128
|
+
{steps[numberOfSteps - 1].to.token.displayName}
|
|
129
|
+
</Typography>
|
|
130
|
+
</Tooltip>
|
|
131
|
+
</div>
|
|
132
|
+
</div>
|
|
133
|
+
<StyledPriceImpact
|
|
134
|
+
size="xsmall"
|
|
135
|
+
warningLevel={warningLevel}
|
|
136
|
+
outputUsdValue={outputPrice.usdValue}
|
|
137
|
+
realOutputUsdValue={outputPrice.realUsdValue}
|
|
138
|
+
percentageChange={percentageChange}
|
|
139
|
+
tooltipProps={{
|
|
140
|
+
container: tooltipContainer,
|
|
141
|
+
}}
|
|
142
|
+
/>
|
|
143
|
+
</OutputSection>
|
|
144
|
+
</Steps>
|
|
145
|
+
</RouteContainer>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PriceImpactProps } from '../PriceImpact/PriceImpact.types';
|
|
2
|
+
import type { PropTypes as QuoteCostProps } from '../QuoteCost/QuoteCost.types';
|
|
3
|
+
import type { Step } from '../StepDetails/StepDetails.types';
|
|
4
|
+
import type { RouteTag } from 'rango-sdk';
|
|
5
|
+
import type { SwapInputProps } from 'src/containers/SwapInput/SwapInput.types';
|
|
6
|
+
|
|
7
|
+
export interface PropTypes {
|
|
8
|
+
steps: Step[];
|
|
9
|
+
tags: RouteTag[];
|
|
10
|
+
time: QuoteCostProps['time'];
|
|
11
|
+
fee: QuoteCostProps['fee'];
|
|
12
|
+
percentageChange?: PriceImpactProps['percentageChange'];
|
|
13
|
+
warningLevel?: PriceImpactProps['warningLevel'];
|
|
14
|
+
outputPrice: SwapInputProps['price'];
|
|
15
|
+
tooltipContainer?: HTMLElement;
|
|
16
|
+
onClick?: () => void;
|
|
17
|
+
selected?: boolean;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ExpandedRoute } from './ExpandedRoute';
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import type { Step } from '../StepDetails/StepDetails.types';
|
|
2
|
+
|
|
3
|
+
export const steps: Step[] = [
|
|
4
|
+
{
|
|
5
|
+
swapper: {
|
|
6
|
+
displayName: 'AllBridge',
|
|
7
|
+
image:
|
|
8
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/swappers/AllBridge/icon.svg',
|
|
9
|
+
},
|
|
10
|
+
from: {
|
|
11
|
+
token: {
|
|
12
|
+
displayName: 'USDC',
|
|
13
|
+
image: 'https://rango.vip/i/mh9zko',
|
|
14
|
+
},
|
|
15
|
+
chain: {
|
|
16
|
+
displayName: 'Polygon',
|
|
17
|
+
image:
|
|
18
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/blockchains/POLYGON/icon.svg',
|
|
19
|
+
},
|
|
20
|
+
price: {
|
|
21
|
+
value: '1.00000000',
|
|
22
|
+
realValue: '5.5',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
to: {
|
|
26
|
+
chain: {
|
|
27
|
+
displayName: 'ETH',
|
|
28
|
+
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
29
|
+
},
|
|
30
|
+
token: {
|
|
31
|
+
displayName: 'ETH',
|
|
32
|
+
|
|
33
|
+
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
34
|
+
},
|
|
35
|
+
price: {
|
|
36
|
+
value: '14.863736725876758517',
|
|
37
|
+
realValue: '5.5',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
swapper: {
|
|
43
|
+
displayName: 'ThorChain',
|
|
44
|
+
image: 'https://api.rango.exchange/swappers/Thorchain.svg',
|
|
45
|
+
},
|
|
46
|
+
from: {
|
|
47
|
+
token: {
|
|
48
|
+
displayName: 'AVAX',
|
|
49
|
+
image: 'https://api.rango.exchange/tokens/AVAX/AVAX.png',
|
|
50
|
+
},
|
|
51
|
+
chain: {
|
|
52
|
+
displayName: 'Avax',
|
|
53
|
+
image:
|
|
54
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/blockchains/AVAX_CCHAIN/icon.svg',
|
|
55
|
+
},
|
|
56
|
+
price: {
|
|
57
|
+
value: '1.00000000',
|
|
58
|
+
realValue: '5.5',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
to: {
|
|
62
|
+
chain: {
|
|
63
|
+
displayName: 'ETH',
|
|
64
|
+
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
65
|
+
},
|
|
66
|
+
token: {
|
|
67
|
+
displayName: 'ETH',
|
|
68
|
+
|
|
69
|
+
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
70
|
+
},
|
|
71
|
+
price: {
|
|
72
|
+
value: '14.863736725876758517',
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
swapper: {
|
|
78
|
+
displayName: 'Satellite',
|
|
79
|
+
image: 'https://api.rango.exchange/swappers/satellite.png',
|
|
80
|
+
},
|
|
81
|
+
from: {
|
|
82
|
+
token: {
|
|
83
|
+
displayName: 'WMATIC',
|
|
84
|
+
image: 'https://rango.vip/i/NcQpfK',
|
|
85
|
+
},
|
|
86
|
+
chain: {
|
|
87
|
+
displayName: 'BTC',
|
|
88
|
+
image: 'https://api.rango.exchange/tokens/BTC/BTC.png',
|
|
89
|
+
},
|
|
90
|
+
price: {
|
|
91
|
+
value: '3.5',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
to: {
|
|
95
|
+
chain: {
|
|
96
|
+
displayName: 'ETH',
|
|
97
|
+
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
98
|
+
},
|
|
99
|
+
token: {
|
|
100
|
+
displayName: 'ETH',
|
|
101
|
+
|
|
102
|
+
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
103
|
+
},
|
|
104
|
+
price: {
|
|
105
|
+
value: '14.863736725876758517',
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
swapper: {
|
|
111
|
+
displayName: 'CurveFi',
|
|
112
|
+
image:
|
|
113
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/swappers/CurveFi/icon.png',
|
|
114
|
+
},
|
|
115
|
+
from: {
|
|
116
|
+
token: {
|
|
117
|
+
displayName: 'BTC',
|
|
118
|
+
image: 'https://api.rango.exchange/tokens/BTC/BTC.png',
|
|
119
|
+
},
|
|
120
|
+
chain: {
|
|
121
|
+
displayName: 'BTC',
|
|
122
|
+
image: 'https://api.rango.exchange/tokens/BTC/BTC.png',
|
|
123
|
+
},
|
|
124
|
+
price: {
|
|
125
|
+
value: '2',
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
to: {
|
|
129
|
+
chain: {
|
|
130
|
+
displayName: 'ETH',
|
|
131
|
+
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
132
|
+
},
|
|
133
|
+
token: {
|
|
134
|
+
displayName: 'ETH',
|
|
135
|
+
|
|
136
|
+
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
137
|
+
},
|
|
138
|
+
price: {
|
|
139
|
+
value: '14.863736725876758517',
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
swapper: {
|
|
145
|
+
displayName: '1inch',
|
|
146
|
+
image:
|
|
147
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/swappers/1Inch/icon.svg',
|
|
148
|
+
},
|
|
149
|
+
from: {
|
|
150
|
+
token: {
|
|
151
|
+
displayName: 'OSMO',
|
|
152
|
+
image: 'https://api.rango.exchange/tokens/COSMOS/OSMO.png',
|
|
153
|
+
},
|
|
154
|
+
chain: {
|
|
155
|
+
displayName: 'Osmosis',
|
|
156
|
+
image:
|
|
157
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/blockchains/OSMOSIS/icon.svg',
|
|
158
|
+
},
|
|
159
|
+
price: {
|
|
160
|
+
value: '5.546',
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
to: {
|
|
164
|
+
chain: {
|
|
165
|
+
displayName: 'ETH',
|
|
166
|
+
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
167
|
+
},
|
|
168
|
+
token: {
|
|
169
|
+
displayName: 'ETH',
|
|
170
|
+
|
|
171
|
+
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
172
|
+
},
|
|
173
|
+
price: {
|
|
174
|
+
value: '14.863736725876758517',
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
swapper: {
|
|
180
|
+
displayName: 'Pancake',
|
|
181
|
+
image:
|
|
182
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/swappers/Pancake/icon.svg',
|
|
183
|
+
},
|
|
184
|
+
from: {
|
|
185
|
+
token: {
|
|
186
|
+
displayName: 'OSMO',
|
|
187
|
+
image: 'https://api.rango.exchange/tokens/COSMOS/OSMO.png',
|
|
188
|
+
},
|
|
189
|
+
chain: {
|
|
190
|
+
displayName: 'Osmosis',
|
|
191
|
+
image:
|
|
192
|
+
'https://raw.githubusercontent.com/rango-exchange/assets/main/blockchains/OSMOSIS/icon.svg',
|
|
193
|
+
},
|
|
194
|
+
price: {
|
|
195
|
+
value: '5.546',
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
to: {
|
|
199
|
+
chain: {
|
|
200
|
+
displayName: 'ETH',
|
|
201
|
+
image: 'https://api.rango.exchange/blockchains/ethereum.svg',
|
|
202
|
+
},
|
|
203
|
+
token: {
|
|
204
|
+
displayName: 'ETH',
|
|
205
|
+
|
|
206
|
+
image: 'https://api.rango.exchange/tokens/ETH/ETH.png',
|
|
207
|
+
},
|
|
208
|
+
price: {
|
|
209
|
+
value: '14.863736725876758517',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
];
|
|
214
|
+
|
|
215
|
+
export const tags = [
|
|
216
|
+
{
|
|
217
|
+
value: 'RECOMMENDED',
|
|
218
|
+
label: 'Recommended',
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
value: 'CENTRALIZED',
|
|
222
|
+
label: 'Centrailized',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
value: 'LOWEST_FEE',
|
|
226
|
+
label: 'Lowest Fee',
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
value: 'FASTEST',
|
|
230
|
+
label: 'Fastest',
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
value: 'HIGH_IMPACT',
|
|
234
|
+
label: 'High Impact',
|
|
235
|
+
},
|
|
236
|
+
];
|
|
@@ -8,13 +8,14 @@ import { Container, OutputUsdValue } from './PriceImpact.styles';
|
|
|
8
8
|
|
|
9
9
|
export function PriceImpact(props: PriceImpactProps) {
|
|
10
10
|
const {
|
|
11
|
-
size,
|
|
11
|
+
size = 'medium',
|
|
12
12
|
outputUsdValue,
|
|
13
13
|
realOutputUsdValue,
|
|
14
14
|
percentageChange,
|
|
15
15
|
warningLevel,
|
|
16
16
|
error,
|
|
17
17
|
tooltipProps,
|
|
18
|
+
...rest
|
|
18
19
|
} = props;
|
|
19
20
|
|
|
20
21
|
let percentageChangeColor = '$neutral600';
|
|
@@ -25,7 +26,7 @@ export function PriceImpact(props: PriceImpactProps) {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<Container>
|
|
29
|
+
<Container {...rest}>
|
|
29
30
|
{outputUsdValue && (
|
|
30
31
|
<Tooltip
|
|
31
32
|
content={realOutputUsdValue}
|
|
@@ -36,17 +37,14 @@ export function PriceImpact(props: PriceImpactProps) {
|
|
|
36
37
|
: undefined
|
|
37
38
|
}
|
|
38
39
|
side={tooltipProps?.side}>
|
|
39
|
-
<OutputUsdValue
|
|
40
|
-
size={size === 'small' ? 'small' : 'medium'}
|
|
41
|
-
variant="body"
|
|
42
|
-
color="$neutral600">
|
|
40
|
+
<OutputUsdValue size={size} variant="body" color="$neutral600">
|
|
43
41
|
{`~$${outputUsdValue}`}
|
|
44
42
|
</OutputUsdValue>
|
|
45
43
|
</Tooltip>
|
|
46
44
|
)}
|
|
47
45
|
{((outputUsdValue && percentageChange) || !outputUsdValue) && (
|
|
48
46
|
<Typography
|
|
49
|
-
size={size
|
|
47
|
+
size={size}
|
|
50
48
|
variant="body"
|
|
51
49
|
ml={4}
|
|
52
50
|
color={percentageChangeColor}>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PropTypes as TooltipPropTypes } from '../Tooltip/Tooltip.types';
|
|
2
|
+
import type { TypographyPropTypes } from '../Typography';
|
|
2
3
|
|
|
3
4
|
export type PriceImpactWarningLevel = 'low' | 'high' | undefined;
|
|
4
5
|
|
|
5
6
|
export type PriceImpactProps = {
|
|
6
|
-
size: '
|
|
7
|
+
size: TypographyPropTypes['size'];
|
|
7
8
|
outputUsdValue?: string;
|
|
8
9
|
realOutputUsdValue?: string;
|
|
9
10
|
error?: string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { css, darkTheme, styled } from '../../theme';
|
|
2
|
+
|
|
3
|
+
export const getLabelStyles = css({});
|
|
4
|
+
|
|
5
|
+
export const TagContainer = styled('div', {
|
|
6
|
+
backgroundColor: '$neutral400',
|
|
7
|
+
borderRadius: '$xs',
|
|
8
|
+
padding: '$2 $5',
|
|
9
|
+
display: 'flex',
|
|
10
|
+
justifyContent: 'center',
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
variants: {
|
|
13
|
+
type: {
|
|
14
|
+
RECOMMENDED: {
|
|
15
|
+
[`& .${getLabelStyles}`]: {
|
|
16
|
+
color: '$secondary500',
|
|
17
|
+
[`.${darkTheme} &`]: {
|
|
18
|
+
color: '$secondary400',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
FASTEST: {
|
|
23
|
+
[`& .${getLabelStyles}`]: {
|
|
24
|
+
color: '$success500',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
HIGH_IMPACT: {
|
|
28
|
+
[`& .${getLabelStyles}`]: {
|
|
29
|
+
color: '$error500',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
LOWEST_FEE: {
|
|
33
|
+
[`& .${getLabelStyles}`]: {
|
|
34
|
+
color: '#FF4DAD',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
CENTRALIZED: {
|
|
38
|
+
[`& .${getLabelStyles}`]: {
|
|
39
|
+
color: '$warning500',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|