@rango-dev/ui 0.22.1-next.16 → 0.22.1-next.18

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.
Files changed (61) hide show
  1. package/dist/index.js +6 -6
  2. package/dist/index.js.map +4 -4
  3. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts +157 -0
  4. package/dist/widget/ui/src/components/Alert/Alert.styles.d.ts.map +1 -1
  5. package/dist/widget/ui/src/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +1 -1
  6. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.d.ts.map +1 -1
  7. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts +314 -0
  8. package/dist/widget/ui/src/components/QuoteCost/QuoteCost.styles.d.ts.map +1 -1
  9. package/dist/widget/ui/src/components/StepDetails/StepDetails.d.ts.map +1 -1
  10. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts +6 -0
  11. package/dist/widget/ui/src/components/StepDetails/StepDetails.styles.d.ts.map +1 -1
  12. package/dist/widget/ui/src/components/SwapListItem/mock.d.ts +1 -1
  13. package/dist/widget/ui/src/components/SwapListItem/mock.d.ts.map +1 -1
  14. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.d.ts.map +1 -1
  15. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts +471 -1
  16. package/dist/widget/ui/src/components/TokenAmount/TokenAmount.styles.d.ts.map +1 -1
  17. package/dist/widget/ui/src/components/common/Image.d.ts +157 -0
  18. package/dist/widget/ui/src/components/common/Image.d.ts.map +1 -1
  19. package/dist/widget/ui/src/components/common/index.d.ts +1 -1
  20. package/dist/widget/ui/src/components/common/index.d.ts.map +1 -1
  21. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts +1 -1
  22. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.d.ts.map +1 -1
  23. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts +2 -2
  24. package/dist/widget/ui/src/containers/SwapHistory/SwapHistory.stories.d.ts.map +1 -1
  25. package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts +1 -1
  26. package/dist/widget/ui/src/containers/SwapHistory/mock.d.ts.map +1 -1
  27. package/dist/widget/ui/src/containers/SwapInput/SwapInput.d.ts.map +1 -1
  28. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts +942 -0
  29. package/dist/widget/ui/src/containers/SwapInput/SwapInput.styles.d.ts.map +1 -1
  30. package/dist/widget/ui/src/containers/SwapInput/TokenSection.d.ts.map +1 -1
  31. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts +471 -0
  32. package/dist/widget/ui/src/containers/SwapInput/TokenSection.styles.d.ts.map +1 -1
  33. package/dist/widget/ui/src/types/index.d.ts +0 -1
  34. package/dist/widget/ui/src/types/index.d.ts.map +1 -1
  35. package/dist/widget/ui/src/types/swaps.d.ts +1 -27
  36. package/dist/widget/ui/src/types/swaps.d.ts.map +1 -1
  37. package/package.json +4 -4
  38. package/src/components/Alert/Alert.styles.ts +7 -7
  39. package/src/components/Alert/Alert.tsx +2 -2
  40. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +2 -1
  41. package/src/components/QuoteCost/QuoteCost.styles.ts +14 -12
  42. package/src/components/QuoteCost/QuoteCost.tsx +12 -7
  43. package/src/components/StepDetails/StepDetails.styles.ts +32 -24
  44. package/src/components/StepDetails/StepDetails.tsx +8 -4
  45. package/src/components/SwapListItem/mock.ts +21 -6
  46. package/src/components/TokenAmount/TokenAmount.styles.ts +12 -10
  47. package/src/components/TokenAmount/TokenAmount.tsx +23 -17
  48. package/src/components/common/Image.tsx +1 -2
  49. package/src/components/common/index.ts +1 -1
  50. package/src/containers/SwapHistory/SwapHistory.stories.tsx +5 -2
  51. package/src/containers/SwapHistory/SwapHistory.tsx +1 -1
  52. package/src/containers/SwapHistory/mock.ts +24 -8
  53. package/src/containers/SwapInput/SwapInput.styles.ts +34 -27
  54. package/src/containers/SwapInput/SwapInput.tsx +14 -8
  55. package/src/containers/SwapInput/TokenSection.styles.ts +16 -13
  56. package/src/containers/SwapInput/TokenSection.tsx +10 -4
  57. package/src/types/index.ts +0 -1
  58. package/src/types/swaps.ts +0 -38
  59. package/dist/widget/ui/src/containers/History/types.d.ts +0 -2
  60. package/dist/widget/ui/src/containers/History/types.d.ts.map +0 -1
  61. package/src/containers/History/types.tsx +0 -1
@@ -5,14 +5,19 @@ import React from 'react';
5
5
  import { GasIcon, NumberIcon, TimeIcon } from '../../icons';
6
6
  import { Typography } from '../Typography';
7
7
 
8
- import { Container, Separator } from './QuoteCost.styles';
8
+ import {
9
+ Container,
10
+ iconStyles,
11
+ itemStyles,
12
+ Separator,
13
+ } from './QuoteCost.styles';
9
14
 
10
15
  export function QuoteCost(props: PropTypes) {
11
16
  const { fee, time, steps } = props;
12
17
  return (
13
18
  <Container>
14
- <div className="item">
15
- <div className="icon">
19
+ <div className={itemStyles()}>
20
+ <div className={iconStyles()}>
16
21
  <GasIcon size={12} color={'gray'} />
17
22
  </div>
18
23
  <Typography ml={2} align="center" variant="body" size="small">
@@ -20,8 +25,8 @@ export function QuoteCost(props: PropTypes) {
20
25
  </Typography>
21
26
  </div>
22
27
  <Separator />
23
- <div className="item">
24
- <div className="icon">
28
+ <div className={itemStyles()}>
29
+ <div className={iconStyles()}>
25
30
  <TimeIcon size={12} color="gray" />
26
31
  </div>
27
32
  <Typography ml={2} align="center" variant="body" size="small">
@@ -29,8 +34,8 @@ export function QuoteCost(props: PropTypes) {
29
34
  </Typography>
30
35
  </div>
31
36
  <Separator />
32
- <div className="item">
33
- <div className="icon">
37
+ <div className={itemStyles()}>
38
+ <div className={iconStyles()}>
34
39
  <NumberIcon size={16} color="gray" />
35
40
  </div>
36
41
  <Typography ml={2} align="center" variant="body" size="small">
@@ -1,3 +1,5 @@
1
+ import { css } from '@stitches/react';
2
+
1
3
  import { darkTheme, styled } from '../../theme';
2
4
 
3
5
  export const Container = styled('div', {
@@ -31,34 +33,10 @@ export const Container = styled('div', {
31
33
  error: { borderColor: '$error500' },
32
34
  },
33
35
  },
34
- '& .swapper': {
35
- display: 'flex',
36
- alignItems: 'center',
37
- },
38
36
  '& .swapper__description': {
39
37
  fontWeight: '$medium',
40
38
  },
41
- '& .step-info': {
42
- display: 'flex',
43
- flex: '1',
44
- width: '100%',
45
- alignItems: 'start',
46
- variants: {
47
- tx: {
48
- true: {
49
- paddingLeft: '36px',
50
- },
51
- },
52
- },
53
- },
54
39
  '& div:nth-child(3)': { display: 'flex', flexDirection: 'column', flex: 1 },
55
- '& .tokens-container': { width: '100%' },
56
- '& .tokens': {
57
- display: 'flex',
58
- paddingTop: '$5',
59
- paddingBottom: '$10',
60
- alignItems: 'center',
61
- },
62
40
  });
63
41
 
64
42
  export const SwapperImage = styled('div', {
@@ -131,3 +109,33 @@ export const StepSeparator = styled('div', {
131
109
  },
132
110
  },
133
111
  });
112
+
113
+ export const tokensContainerStyles = css({
114
+ width: '100%',
115
+ });
116
+
117
+ export const swapperStyles = css({
118
+ display: 'flex',
119
+ alignItems: 'center',
120
+ });
121
+
122
+ export const stepInfoStyles = css({
123
+ display: 'flex',
124
+ flex: '1',
125
+ width: '100%',
126
+ alignItems: 'start',
127
+ variants: {
128
+ tx: {
129
+ true: {
130
+ paddingLeft: '36px',
131
+ },
132
+ },
133
+ },
134
+ });
135
+
136
+ export const tokensStyles = css({
137
+ display: 'flex',
138
+ paddingTop: '$5',
139
+ paddingBottom: '$10',
140
+ alignItems: 'center',
141
+ });
@@ -13,8 +13,12 @@ import {
13
13
  Alerts,
14
14
  Container,
15
15
  DashedLine,
16
+ stepInfoStyles,
16
17
  StepSeparator,
17
18
  SwapperImage,
19
+ swapperStyles,
20
+ tokensContainerStyles,
21
+ tokensStyles,
18
22
  } from './StepDetails.styles';
19
23
 
20
24
  const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
@@ -39,7 +43,7 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
39
43
  state={state}
40
44
  ref={containerRef}
41
45
  tabIndex={tabIndex}>
42
- <div className="swapper">
46
+ <div className={swapperStyles()}>
43
47
  {type === 'swap-progress' && hasSeparator && (
44
48
  <StepSeparator state={state} />
45
49
  )}
@@ -60,10 +64,10 @@ const StepDetailsComponent = forwardRef<HTMLDivElement, StepDetailsProps>(
60
64
  })}
61
65
  </Typography>
62
66
  </div>
63
- <div className="step-info">
67
+ <div className={stepInfoStyles()}>
64
68
  <DashedLine invisible={!hasSeparator || type === 'swap-progress'} />
65
- <div className="tokens-container">
66
- <div className="tokens">
69
+ <div className={tokensContainerStyles()}>
70
+ <div className={tokensStyles()}>
67
71
  <ChainToken
68
72
  chainImage={step.from.chain.image}
69
73
  tokenImage={step.from.token.image}
@@ -1,11 +1,12 @@
1
1
  /* eslint-disable @typescript-eslint/no-magic-numbers */
2
- // TODO: fix ts errors
3
- // eslint-disable-next-line
4
- // @ts-nocheck
5
2
  import type { SwapTokenData } from './SwapListItem.types';
6
- import type { PendingSwap } from '../../containers/History/types';
3
+ import type { PendingSwap } from 'rango-types';
7
4
 
8
- import { RoutingResultType, TransactionType } from 'rango-sdk';
5
+ import {
6
+ MessageSeverity,
7
+ RoutingResultType,
8
+ TransactionType,
9
+ } from 'rango-types';
9
10
 
10
11
  export const swap: PendingSwap = {
11
12
  creationTime: '1673164511955',
@@ -21,7 +22,7 @@ export const swap: PendingSwap = {
21
22
  status: 'running',
22
23
  isPaused: false,
23
24
  extraMessage: null,
24
- extraMessageSeverity: 'info',
25
+ extraMessageSeverity: MessageSeverity.info,
25
26
  extraMessageDetail: '',
26
27
  extraMessageErrorCode: null,
27
28
  networkStatusExtraMessage: null,
@@ -75,6 +76,7 @@ export const swap: PendingSwap = {
75
76
  expenseType: 'FROM_SOURCE_WALLET',
76
77
  name: 'Network Fee',
77
78
  amount: '0',
79
+ price: null,
78
80
  },
79
81
  ],
80
82
  estimatedTimeInSeconds: 45,
@@ -150,6 +152,7 @@ export const swap: PendingSwap = {
150
152
  includesDestinationTx: false,
151
153
  maxRequiredSign: 1,
152
154
  warnings: [],
155
+ internalSwaps: null,
153
156
  },
154
157
  ],
155
158
  },
@@ -164,16 +167,20 @@ export const swap: PendingSwap = {
164
167
  'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
165
168
  fromDecimals: 6,
166
169
  fromAmountPrecision: null,
170
+ fromAmountRestrictionType: 'EXCLUSIVE',
171
+ estimatedTimeInSeconds: 5,
167
172
  fromAmountMinValue: null,
168
173
  fromAmountMaxValue: null,
169
174
  toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
170
175
  fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
176
+ fromUsdPrice: null,
171
177
  toBlockchain: 'OSMOSIS',
172
178
  fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
173
179
  toSymbol: 'OSMO',
174
180
  toSymbolAddress: null,
175
181
  toDecimals: 6,
176
182
  toLogo: 'https://api.rango.exchange/i/mJQPS2',
183
+ toUsdPrice: null,
177
184
  startTransactionTime: 1673164519916,
178
185
  swapperId: 'Osmosis',
179
186
  swapperLogo: 'https://api.rango.exchange/swappers/osmosis.png',
@@ -189,6 +196,13 @@ export const swap: PendingSwap = {
189
196
  description: null,
190
197
  },
191
198
  ],
199
+ starknetApprovalTransaction: null,
200
+ starknetTransaction: null,
201
+ tronApprovalTransaction: null,
202
+ tonTransaction: null,
203
+ tronTransaction: null,
204
+ feeInUsd: null,
205
+ executedTransactionTime: null,
192
206
  cosmosTransaction: {
193
207
  type: TransactionType.COSMOS,
194
208
  fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
@@ -276,6 +290,7 @@ export const swap: PendingSwap = {
276
290
  transferTransaction: null,
277
291
  diagnosisUrl: null,
278
292
  internalSteps: null,
293
+ internalSwaps: null,
279
294
  },
280
295
  ],
281
296
  };
@@ -1,4 +1,4 @@
1
- import { styled } from '@stitches/react';
1
+ import { css, styled } from '../../theme';
2
2
 
3
3
  export const Container = styled('div', {
4
4
  display: 'flex',
@@ -15,13 +15,15 @@ export const Container = styled('div', {
15
15
  true: { alignItems: 'center', justifyContent: 'center' },
16
16
  },
17
17
  },
18
- '& .token-amount': {
19
- display: 'flex',
20
- justifyContent: 'center',
21
- alignItems: 'center',
22
- },
23
- '& .usd-value': {
24
- display: 'flex',
25
- paddingTop: '$5',
26
- },
18
+ });
19
+
20
+ export const tokenAmountStyles = css({
21
+ display: 'flex',
22
+ justifyContent: 'center',
23
+ alignItems: 'center',
24
+ });
25
+
26
+ export const usdValueStyles = css({
27
+ display: 'flex',
28
+ paddingTop: '$5',
27
29
  });
@@ -6,12 +6,16 @@ import { ChainToken } from '../ChainToken';
6
6
  import { PriceImpact } from '../PriceImpact/PriceImpact';
7
7
  import { Typography } from '../Typography';
8
8
 
9
- import { Container } from './TokenAmount.styles';
9
+ import {
10
+ Container,
11
+ tokenAmountStyles,
12
+ usdValueStyles,
13
+ } from './TokenAmount.styles';
10
14
 
11
15
  export function TokenAmount(props: PropTypes) {
12
16
  return (
13
17
  <Container direction={props.direction} centerAlign={props.centerAlign}>
14
- <div className="token-amount">
18
+ <div className={tokenAmountStyles()}>
15
19
  <ChainToken
16
20
  chainImage={props.chain.image}
17
21
  tokenImage={props.token.image}
@@ -41,21 +45,23 @@ export function TokenAmount(props: PropTypes) {
41
45
  </div>
42
46
  </div>
43
47
  </div>
44
- <div className="usd-value">
45
- {props.type === 'input' && (
46
- <Typography mr={4} size="small" variant="body" color="$neutral700">
47
- {`~$${props.price.usdValue}`}
48
- </Typography>
49
- )}
50
- {props.type === 'output' && (
51
- <PriceImpact
52
- size="small"
53
- outputUsdValue={props.price.usdValue}
54
- percentageChange={props.percentageChange}
55
- warningLevel={props.warningLevel}
56
- />
57
- )}
58
- </div>
48
+ {props.price.usdValue && props.price.usdValue !== '0' && (
49
+ <div className={usdValueStyles()}>
50
+ {props.type === 'input' && (
51
+ <Typography mr={4} size="small" variant="body" color="$neutral700">
52
+ {`~$${props.price.usdValue}`}
53
+ </Typography>
54
+ )}
55
+ {props.type === 'output' && (
56
+ <PriceImpact
57
+ size="small"
58
+ outputUsdValue={props.price.usdValue}
59
+ percentageChange={props.percentageChange}
60
+ warningLevel={props.warningLevel}
61
+ />
62
+ )}
63
+ </div>
64
+ )}
59
65
  </Container>
60
66
  );
61
67
  }
@@ -2,7 +2,7 @@ import React from 'react';
2
2
 
3
3
  import { styled } from '../../theme';
4
4
 
5
- const ImageContainer = styled('div', {
5
+ export const ImageContainer = styled('div', {
6
6
  display: 'flex',
7
7
  justifyContent: 'center',
8
8
  alignItems: 'center',
@@ -37,7 +37,6 @@ export function Image(props: PropTypes) {
37
37
 
38
38
  return (
39
39
  <ImageContainer
40
- className="image-container"
41
40
  css={{
42
41
  width: size + 'px',
43
42
  height: size + 'px',
@@ -1,2 +1,2 @@
1
1
  export { FilledCircle } from './FilledCircle';
2
- export { Image } from './Image';
2
+ export { Image, ImageContainer } from './Image';
@@ -1,7 +1,10 @@
1
+ import type { PropTypes } from './SwapHistory';
2
+ import type { Meta } from '@storybook/react';
3
+
1
4
  import React from 'react';
2
- import { Meta } from '@storybook/react';
3
- import { PropTypes, SwapHistory } from './SwapHistory';
5
+
4
6
  import { pendingSwap } from './mock';
7
+ import { SwapHistory } from './SwapHistory';
5
8
 
6
9
  export default {
7
10
  title: 'Containers/Swap History',
@@ -1,5 +1,5 @@
1
1
  import type { PropTypes as SwapMessagesPropTypes } from './SwapMessages';
2
- import type { PendingSwap } from '../History/types';
2
+ import type { PendingSwap } from 'rango-types';
3
3
 
4
4
  import React, { useState } from 'react';
5
5
 
@@ -1,6 +1,8 @@
1
- // @ts-nocheck
1
+ /* eslint-disable @typescript-eslint/no-magic-numbers */
2
+ import type { PendingSwap } from 'rango-types';
3
+
2
4
  import { RoutingResultType, TransactionType } from 'rango-sdk';
3
- import { PendingSwap } from '../History/types';
5
+ import { MessageSeverity } from 'rango-types';
4
6
 
5
7
  export const pendingSwap: PendingSwap = {
6
8
  creationTime: '1673164511955',
@@ -16,7 +18,7 @@ export const pendingSwap: PendingSwap = {
16
18
  status: 'running',
17
19
  isPaused: false,
18
20
  extraMessage: null,
19
- extraMessageSeverity: 'info',
21
+ extraMessageSeverity: MessageSeverity.info,
20
22
  extraMessageDetail: '',
21
23
  extraMessageErrorCode: null,
22
24
  networkStatusExtraMessage: null,
@@ -34,14 +36,14 @@ export const pendingSwap: PendingSwap = {
34
36
  {
35
37
  swapperId: 'Osmosis',
36
38
  swapperType: 'DEX',
37
- swapperLogo: 'https://api.rango.exchange/swappers/osmosis.png',
39
+ swapperLogo: '',
38
40
  from: {
39
41
  symbol: 'JUNO',
40
42
  logo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
41
43
  address:
42
44
  'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
43
45
  blockchain: 'OSMOSIS',
44
- blockchainLogo: '',
46
+ blockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
45
47
  decimals: 6,
46
48
  usdPrice: 1.1091996179668873,
47
49
  },
@@ -51,7 +53,7 @@ export const pendingSwap: PendingSwap = {
51
53
  address: null,
52
54
  blockchain: 'OSMOSIS',
53
55
  decimals: 6,
54
- blockchainLogo: '',
56
+ blockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
55
57
  usdPrice: 0.7192435454440882,
56
58
  },
57
59
  fromAmount: '1.000000',
@@ -68,8 +70,9 @@ export const pendingSwap: PendingSwap = {
68
70
  address: null,
69
71
  },
70
72
  expenseType: 'FROM_SOURCE_WALLET',
71
- amount: '0',
72
73
  name: 'Network Fee',
74
+ amount: '0',
75
+ price: null,
73
76
  },
74
77
  ],
75
78
  estimatedTimeInSeconds: 45,
@@ -145,6 +148,7 @@ export const pendingSwap: PendingSwap = {
145
148
  includesDestinationTx: false,
146
149
  maxRequiredSign: 1,
147
150
  warnings: [],
151
+ internalSwaps: null,
148
152
  },
149
153
  ],
150
154
  },
@@ -154,21 +158,25 @@ export const pendingSwap: PendingSwap = {
154
158
  id: 1,
155
159
  fromBlockchain: 'OSMOSIS',
156
160
  fromSymbol: 'JUNO',
161
+ swapperType: 'test',
157
162
  fromSymbolAddress:
158
163
  'ibc/46b44899322f3cd854d2d46deef881958467cdd4b3b10086da49296bbed94bed',
159
164
  fromDecimals: 6,
160
165
  fromAmountPrecision: null,
166
+ fromAmountRestrictionType: 'EXCLUSIVE',
167
+ estimatedTimeInSeconds: 5,
161
168
  fromAmountMinValue: null,
162
169
  fromAmountMaxValue: null,
170
+ fromUsdPrice: null,
163
171
  toBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
164
172
  fromBlockchainLogo: 'https://api.rango.exchange/swappers/osmosis.png',
165
173
  toBlockchain: 'OSMOSIS',
166
174
  fromLogo: 'https://api.rango.exchange/tokens/COSMOS/JUNO.png',
167
175
  toSymbol: 'OSMO',
168
176
  toSymbolAddress: null,
169
- swapperType: 'DEX',
170
177
  toDecimals: 6,
171
178
  toLogo: 'https://api.rango.exchange/i/mJQPS2',
179
+ toUsdPrice: null,
172
180
  startTransactionTime: 1673164519916,
173
181
  swapperId: 'Osmosis',
174
182
  swapperLogo: 'https://api.rango.exchange/swappers/osmosis.png',
@@ -184,6 +192,13 @@ export const pendingSwap: PendingSwap = {
184
192
  description: null,
185
193
  },
186
194
  ],
195
+ starknetApprovalTransaction: null,
196
+ starknetTransaction: null,
197
+ tronApprovalTransaction: null,
198
+ tonTransaction: null,
199
+ tronTransaction: null,
200
+ feeInUsd: null,
201
+ executedTransactionTime: null,
187
202
  cosmosTransaction: {
188
203
  type: TransactionType.COSMOS,
189
204
  fromWalletAddress: 'osmo1unf2rcytjxfpz8x8ar63h4qeftadptg5t0nqcl',
@@ -271,6 +286,7 @@ export const pendingSwap: PendingSwap = {
271
286
  transferTransaction: null,
272
287
  diagnosisUrl: null,
273
288
  internalSteps: null,
289
+ internalSwaps: null,
274
290
  },
275
291
  ],
276
292
  };
@@ -1,5 +1,7 @@
1
1
  import { Button, TextField } from '../../components';
2
- import { darkTheme, styled } from '../../theme';
2
+ import { css, darkTheme, styled } from '../../theme';
3
+
4
+ export const textStyles = css();
3
5
 
4
6
  export const Container = styled('div', {
5
7
  $$color: '$colors$neutral100',
@@ -17,38 +19,13 @@ export const Container = styled('div', {
17
19
  },
18
20
  },
19
21
  },
20
- '& .gray-text': {
22
+ [`& .${textStyles}`]: {
21
23
  $$color: '$colors$neutral600',
22
24
  [`.${darkTheme} &`]: {
23
25
  $$color: '$colors$neutral700',
24
26
  },
25
27
  color: '$$color',
26
28
  },
27
- '& .label__container': {
28
- paddingBottom: '$5',
29
- },
30
- '& .label': {
31
- display: 'flex',
32
- justifyContent: 'space-between',
33
- alignItems: 'center',
34
- },
35
- '& .balance': {
36
- display: 'flex',
37
- justifyContent: 'center',
38
- alignItems: 'center',
39
- },
40
- '& .form': {
41
- display: 'flex',
42
- justifyContent: 'space-between',
43
- alignItems: 'center',
44
- },
45
- '& .amount': {
46
- display: 'flex',
47
- flexDirection: 'column',
48
- justifyContent: 'center',
49
- alignItems: 'end',
50
- flexGrow: 1,
51
- },
52
29
  });
53
30
 
54
31
  export const InputAmount = styled(TextField, {
@@ -95,3 +72,33 @@ export const ValueTypography = styled('div', {
95
72
  },
96
73
  },
97
74
  });
75
+
76
+ export const formStyles = css({
77
+ display: 'flex',
78
+ justifyContent: 'space-between',
79
+ alignItems: 'center',
80
+ });
81
+
82
+ export const labelStyles = css({
83
+ display: 'flex',
84
+ justifyContent: 'space-between',
85
+ alignItems: 'center',
86
+ });
87
+
88
+ export const balanceStyles = css({
89
+ display: 'flex',
90
+ justifyContent: 'center',
91
+ alignItems: 'center',
92
+ });
93
+
94
+ export const amountStyles = css({
95
+ display: 'flex',
96
+ flexDirection: 'column',
97
+ justifyContent: 'center',
98
+ alignItems: 'end',
99
+ flexGrow: 1,
100
+ });
101
+
102
+ export const labelContainerStyles = css({
103
+ paddingBottom: '$5',
104
+ });
@@ -6,9 +6,15 @@ import React from 'react';
6
6
  import { Divider, PriceImpact, Skeleton, Typography } from '../../components';
7
7
 
8
8
  import {
9
+ amountStyles,
10
+ balanceStyles,
9
11
  Container,
12
+ formStyles,
10
13
  InputAmount,
14
+ labelContainerStyles,
15
+ labelStyles,
11
16
  MaxButton,
17
+ textStyles,
12
18
  ValueTypography,
13
19
  } from './SwapInput.styles';
14
20
  import { TokenSection } from './TokenSection';
@@ -16,15 +22,15 @@ import { TokenSection } from './TokenSection';
16
22
  export function SwapInput(props: SwapInputProps) {
17
23
  return (
18
24
  <Container sharpBottomStyle={props.sharpBottomStyle}>
19
- <div className="label__container">
20
- <div className="label">
21
- <Typography variant="body" size="small" className="gray-text">
25
+ <div className={labelContainerStyles()}>
26
+ <div className={labelStyles()}>
27
+ <Typography variant="body" size="small" className={textStyles()}>
22
28
  {props.label}
23
29
  </Typography>
24
30
  {'balance' in props && !props.loading && (
25
- <div className="balance">
31
+ <div className={balanceStyles()}>
26
32
  <Typography
27
- className="gray-text"
33
+ className={textStyles()}
28
34
  mr={4}
29
35
  variant="body"
30
36
  size="xsmall">
@@ -41,13 +47,13 @@ export function SwapInput(props: SwapInputProps) {
41
47
  </div>
42
48
  )}
43
49
  {props.loading && (
44
- <div className="balance">
50
+ <div className={balanceStyles()}>
45
51
  <Skeleton variant="text" size="large" width={105} />
46
52
  </div>
47
53
  )}
48
54
  </div>
49
55
  </div>
50
- <div className="form">
56
+ <div className={formStyles()}>
51
57
  <TokenSection
52
58
  chain={props.chain.displayName}
53
59
  tokenSymbol={props.token.displayName}
@@ -57,7 +63,7 @@ export function SwapInput(props: SwapInputProps) {
57
63
  onClick={props.onClickToken}
58
64
  loading={props.loading}
59
65
  />
60
- <div className="amount">
66
+ <div className={amountStyles()}>
61
67
  {props.loading || (props.mode === 'To' && props.fetchingQuote) ? (
62
68
  <>
63
69
  <Skeleton variant="text" size="large" width={92} />
@@ -1,5 +1,5 @@
1
1
  import { Button } from '../../components';
2
- import { darkTheme, styled } from '../../theme';
2
+ import { css, darkTheme, styled } from '../../theme';
3
3
 
4
4
  export const Container = styled(Button, {
5
5
  maxWidth: '180px',
@@ -28,6 +28,8 @@ export const Container = styled(Button, {
28
28
  },
29
29
  });
30
30
 
31
+ export const chainNameStyles = css();
32
+
31
33
  export const TokenSectionContainer = styled('div', {
32
34
  width: '10.625rem',
33
35
  padding: '$2 $5',
@@ -36,22 +38,23 @@ export const TokenSectionContainer = styled('div', {
36
38
  justifyContent: 'start',
37
39
  boxSizing: 'border-box',
38
40
  alignItems: 'center',
39
-
40
- '& .blockchain-name': {
41
+ [`& .${chainNameStyles}`]: {
41
42
  $$color: '$colors$neutral600',
42
43
  [`.${darkTheme} &`]: {
43
44
  $$color: '$colors$neutral700',
44
45
  },
45
46
  color: '$$color',
46
47
  },
47
- '& .token-chain-name': {
48
- display: 'flex',
49
- flexDirection: 'column',
50
- justifyContent: 'center',
51
- alignItems: 'start',
52
- paddingLeft: '$10',
53
- },
54
- '& .token-chain-name__skeleton': {
55
- padding: '$5 $0',
56
- },
48
+ });
49
+
50
+ export const tokenChainStyles = css({
51
+ display: 'flex',
52
+ flexDirection: 'column',
53
+ justifyContent: 'center',
54
+ alignItems: 'start',
55
+ paddingLeft: '$10',
56
+ });
57
+
58
+ export const skeletonStyles = css({
59
+ padding: '$5 $0',
57
60
  });