@rango-dev/widget-embedded 0.28.1-next.3 → 0.28.1
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/components/BlockchainList/BlockchainList.helpers.d.ts +2 -1
- package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
- package/dist/constants/fonts.d.ts +0 -5
- package/dist/constants/fonts.d.ts.map +1 -1
- package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
- package/dist/globalStyles.d.ts.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -1
- package/dist/utils/common.d.ts +0 -3
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/configs.d.ts +1 -0
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +0 -2
- package/dist/utils/wallets.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/BlockchainList/BlockchainList.helpers.ts +25 -6
- package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +4 -4
- package/src/components/HeaderButtons/HeaderButtons.styles.ts +1 -1
- package/src/components/Quote/Quote.styles.ts +1 -1
- package/src/components/Slippage/Slippage.tsx +1 -1
- package/src/constants/fonts.ts +0 -84
- package/src/containers/WidgetProvider/WidgetProvider.tsx +1 -12
- package/src/globalStyles.ts +3 -1
- package/src/hooks/useBootstrap/useBootstrap.ts +1 -1
- package/src/hooks/useTheme.ts +1 -1
- package/src/index.ts +0 -2
- package/src/pages/SelectBlockchainPage.tsx +3 -3
- package/src/pages/WalletsPage.tsx +2 -34
- package/src/types/config.ts +1 -1
- package/src/utils/common.ts +0 -29
- package/src/utils/configs.ts +1 -0
- package/src/utils/wallets.ts +2 -53
- package/dist/hooks/useFontLoader.d.ts +0 -5
- package/dist/hooks/useFontLoader.d.ts.map +0 -1
- package/src/hooks/useFontLoader.ts +0 -40
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { getFontUrlByName } from '../utils/common';
|
|
4
|
-
/*
|
|
5
|
-
*TODO:
|
|
6
|
-
* Loading fonts from JS has a downside and it is the bundle needs to be downloaded and executed first which means after sometime font will be added to <head /> and it causes a layoutshift each time.
|
|
7
|
-
* We've added Roboto into <head /> since it's the default font. the downside here is it will load roboto anyway even dApp has set fontFamily other than Roboto which causes an unneccerary downloand (Roboto).
|
|
8
|
-
* We decided to go with the second one and it can be solved in future by split these types of configs into a separate js file and let it to be loaded with a more priority than the main bundle. it should be also cached which imrpove user experience after first load.
|
|
9
|
-
*/
|
|
10
|
-
const useFontLoader = () => {
|
|
11
|
-
const [fontLink, setFontLink] = useState<HTMLLinkElement | null>(null);
|
|
12
|
-
|
|
13
|
-
const loadFont = (fontUrl: string) => {
|
|
14
|
-
const link = document.createElement('link');
|
|
15
|
-
link.href = fontUrl;
|
|
16
|
-
link.rel = 'stylesheet';
|
|
17
|
-
document.head.appendChild(link);
|
|
18
|
-
return link;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const unloadFont = () => {
|
|
22
|
-
if (fontLink) {
|
|
23
|
-
document.head.removeChild(fontLink);
|
|
24
|
-
setFontLink(null);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const handleLoadCustomFont = (fontName: string) => {
|
|
29
|
-
unloadFont(); // Remove previous font
|
|
30
|
-
const fontUrl = getFontUrlByName(fontName);
|
|
31
|
-
if (fontUrl) {
|
|
32
|
-
const newFontLink = loadFont(fontUrl);
|
|
33
|
-
setFontLink(newFontLink);
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return { handleLoadCustomFont };
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export default useFontLoader;
|