@rango-dev/widget-embedded 0.1.11-next.5 → 0.1.11-next.6
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/dist/App.d.ts.map +1 -1
- package/dist/components/Layout.d.ts.map +1 -1
- package/dist/components/TokenInfo.d.ts.map +1 -1
- package/dist/components/TokenPreview.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +27 -24
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +27 -24
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +28 -25
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +7 -1
- package/src/components/HeaderButtons.tsx +1 -1
- package/src/components/Layout.tsx +5 -4
- package/src/components/TokenInfo.tsx +4 -8
- package/src/components/TokenPreview.tsx +3 -7
- package/src/hooks/useTheme.ts +6 -0
package/package.json
CHANGED
package/src/App.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SwapContainer } from '@rango-dev/ui';
|
|
2
|
-
import React, { useState } from 'react';
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { AppRouter } from './components/AppRouter';
|
|
4
4
|
import { useMetaStore } from './store/meta';
|
|
5
5
|
import './app.css';
|
|
@@ -46,6 +46,12 @@ export function App({ config }: WidgetProps) {
|
|
|
46
46
|
.filter(isEvmBlockchain)
|
|
47
47
|
.map((chain) => chain.name);
|
|
48
48
|
|
|
49
|
+
const themeBackground = activeTheme?.colors?.background?.value;
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
document.body.style.background = themeBackground;
|
|
53
|
+
}, [themeBackground]);
|
|
54
|
+
|
|
49
55
|
const onUpdateState: EventHandler = (
|
|
50
56
|
type,
|
|
51
57
|
event,
|
|
@@ -30,7 +30,7 @@ export function HeaderButtons(props: PropTypes) {
|
|
|
30
30
|
onClick={onClickRefresh}
|
|
31
31
|
disabled={!onClickRefresh}
|
|
32
32
|
>
|
|
33
|
-
<RetryIcon size={24} />
|
|
33
|
+
<RetryIcon size={24} disabled={!onClickRefresh} />
|
|
34
34
|
</Button>
|
|
35
35
|
</Tooltip>
|
|
36
36
|
<Tooltip content="Transactions History">
|
|
@@ -23,6 +23,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
23
23
|
import { useBestRouteStore } from '../store/bestRoute';
|
|
24
24
|
import { useMetaStore } from '../store/meta';
|
|
25
25
|
import { useSettingsStore } from '../store/settings';
|
|
26
|
+
import { Image } from '@rango-dev/ui';
|
|
26
27
|
|
|
27
28
|
const Header = styled('div', {
|
|
28
29
|
display: 'flex',
|
|
@@ -33,9 +34,7 @@ const Header = styled('div', {
|
|
|
33
34
|
},
|
|
34
35
|
});
|
|
35
36
|
|
|
36
|
-
const
|
|
37
|
-
width: '$24',
|
|
38
|
-
height: '$24',
|
|
37
|
+
const WalletImageContainer = styled('div', {
|
|
39
38
|
marginLeft: -15,
|
|
40
39
|
marginRight: '$6',
|
|
41
40
|
borderRadius: '99999px',
|
|
@@ -116,7 +115,9 @@ export function Layout({ config }: LayoutProps) {
|
|
|
116
115
|
>
|
|
117
116
|
{connectedWalletsImages?.length ? (
|
|
118
117
|
connectedWalletsImages.map((walletImage, index) => (
|
|
119
|
-
<
|
|
118
|
+
<WalletImageContainer key={index}>
|
|
119
|
+
<Image src={walletImage} size={24} />
|
|
120
|
+
</WalletImageContainer>
|
|
120
121
|
))
|
|
121
122
|
) : (
|
|
122
123
|
<></>
|
|
@@ -6,6 +6,8 @@ import {
|
|
|
6
6
|
styled,
|
|
7
7
|
TextField,
|
|
8
8
|
Typography,
|
|
9
|
+
Image,
|
|
10
|
+
Spacer,
|
|
9
11
|
} from '@rango-dev/ui';
|
|
10
12
|
import { useMetaStore } from '../store/meta';
|
|
11
13
|
import { BlockchainMeta, Token } from 'rango-sdk';
|
|
@@ -16,7 +18,6 @@ import BigNumber from 'bignumber.js';
|
|
|
16
18
|
import { getBalanceFromWallet } from '../utils/wallets';
|
|
17
19
|
import { useWalletsStore } from '../store/wallets';
|
|
18
20
|
import { useTranslation } from 'react-i18next';
|
|
19
|
-
import { Spacer } from '@rango-dev/ui';
|
|
20
21
|
import { PercentageChange } from './PercentageChange';
|
|
21
22
|
|
|
22
23
|
type PropTypes = (
|
|
@@ -90,11 +91,6 @@ const Container = styled('div', {
|
|
|
90
91
|
},
|
|
91
92
|
});
|
|
92
93
|
|
|
93
|
-
const StyledImage = styled('img', {
|
|
94
|
-
width: '$24',
|
|
95
|
-
maxHeight: '$24',
|
|
96
|
-
});
|
|
97
|
-
|
|
98
94
|
const Options = styled('div', {
|
|
99
95
|
display: 'flex',
|
|
100
96
|
justifyContent: 'flex-end',
|
|
@@ -234,7 +230,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
234
230
|
loading={loadingStatus === 'loading'}
|
|
235
231
|
prefix={
|
|
236
232
|
loadingStatus === 'success' && chain ? (
|
|
237
|
-
<
|
|
233
|
+
<Image src={chain.logo} size={24} />
|
|
238
234
|
) : (
|
|
239
235
|
<ImagePlaceholder />
|
|
240
236
|
)
|
|
@@ -262,7 +258,7 @@ export function TokenInfo(props: PropTypes) {
|
|
|
262
258
|
loading={loadingStatus === 'loading'}
|
|
263
259
|
prefix={
|
|
264
260
|
loadingStatus === 'success' && token ? (
|
|
265
|
-
<
|
|
261
|
+
<Image src={token.image} size={24} />
|
|
266
262
|
) : (
|
|
267
263
|
<ImagePlaceholder />
|
|
268
264
|
)
|
|
@@ -5,6 +5,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
5
5
|
import { Spacer } from '@rango-dev/ui';
|
|
6
6
|
import BigNumber from 'bignumber.js';
|
|
7
7
|
import { numberToString } from '../utils/numbers';
|
|
8
|
+
import { Image } from '@rango-dev/ui';
|
|
8
9
|
|
|
9
10
|
const Box = styled('div', {
|
|
10
11
|
display: 'flex',
|
|
@@ -60,11 +61,6 @@ const Container = styled('div', {
|
|
|
60
61
|
},
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
const StyledImage = styled('img', {
|
|
64
|
-
width: '$24',
|
|
65
|
-
maxHeight: '$24',
|
|
66
|
-
});
|
|
67
|
-
|
|
68
64
|
const ImagePlaceholder = styled('span', {
|
|
69
65
|
width: '24px',
|
|
70
66
|
height: '24px',
|
|
@@ -142,7 +138,7 @@ export function TokenPreview(props: PropTypes) {
|
|
|
142
138
|
loading={loadingStatus === 'loading'}
|
|
143
139
|
prefix={
|
|
144
140
|
loadingStatus === 'success' && chain ? (
|
|
145
|
-
<
|
|
141
|
+
<Image src={chain.logo} size={24} />
|
|
146
142
|
) : (
|
|
147
143
|
<ImagePlaceholder />
|
|
148
144
|
)
|
|
@@ -162,7 +158,7 @@ export function TokenPreview(props: PropTypes) {
|
|
|
162
158
|
loading={loadingStatus === 'loading'}
|
|
163
159
|
prefix={
|
|
164
160
|
loadingStatus === 'success' && token ? (
|
|
165
|
-
<
|
|
161
|
+
<Image src={token.image} size={24} />
|
|
166
162
|
) : (
|
|
167
163
|
<ImagePlaceholder />
|
|
168
164
|
)
|
package/src/hooks/useTheme.ts
CHANGED
|
@@ -65,6 +65,9 @@ export function useTheme({
|
|
|
65
65
|
radii: {
|
|
66
66
|
5: `${borderRadius}px`,
|
|
67
67
|
},
|
|
68
|
+
shadows: {
|
|
69
|
+
s: '0px 3px 5px 3px #f0f2f5, 0px 6px 10px 3px #f0f2f5, 0px 1px 18px 3px #f0f2f5',
|
|
70
|
+
},
|
|
68
71
|
});
|
|
69
72
|
|
|
70
73
|
const customeDarkTheme = createTheme({
|
|
@@ -84,6 +87,9 @@ export function useTheme({
|
|
|
84
87
|
radii: {
|
|
85
88
|
5: `${borderRadius}px`,
|
|
86
89
|
},
|
|
90
|
+
shadows: {
|
|
91
|
+
s: '0px 3px 5px 3px #222, 0px 6px 10px 3px #222, 0px 1px 18px 3px #222',
|
|
92
|
+
},
|
|
87
93
|
});
|
|
88
94
|
const [OSTheme, setOSTheme] = useState(customeLightTheme);
|
|
89
95
|
useEffect(() => {
|