File tree Expand file tree Collapse file tree 5 files changed +14
-22
lines changed Expand file tree Collapse file tree 5 files changed +14
-22
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @web3-onboard/core" ,
3
- "version" : " 2.0.2 " ,
3
+ "version" : " 2.0.3 " ,
4
4
"scripts" : {
5
5
"build" : " rollup -c" ,
6
6
"dev" : " rollup -c -w" ,
Original file line number Diff line number Diff line change @@ -36,14 +36,6 @@ export function validEnsChain(chainId: ChainId): boolean {
36
36
}
37
37
}
38
38
39
- export function isUrl ( str : string ) : boolean {
40
- let url
41
-
42
- try {
43
- url = new URL ( str )
44
- } catch ( _ ) {
45
- return false
46
- }
47
-
48
- return url . protocol === 'http:' || url . protocol === 'https:'
39
+ export function isSVG ( str : string ) : boolean {
40
+ return str . includes ( '<svg' )
49
41
}
Original file line number Diff line number Diff line change 4
4
import { internalState$ } from ' ../../streams'
5
5
import en from ' ../../i18n/en.json'
6
6
import type { i18n } from ' ../../types'
7
- import { isUrl } from ' ../../utils'
7
+ import { isSVG } from ' ../../utils'
8
8
9
9
export let step: keyof i18n [' connect' ]
10
10
111
111
<div class =" inner-container" >
112
112
<div class =" icon-container" >
113
113
{#if logo || icon }
114
- {#if isUrl (logo || icon )}
115
- <img height ="100%" src ={logo || icon } alt =" logo" />
116
- {:else }
114
+ {#if isSVG (logo || icon )}
117
115
{@html logo || icon }
116
+ {:else }
117
+ <img height ="100%" src ={logo || icon } alt =" logo" />
118
118
{/if }
119
119
{:else }
120
120
{@html blocknative }
Original file line number Diff line number Diff line change 1
1
<script lang =" ts" >
2
2
import { fade } from ' svelte/transition'
3
- import { isUrl } from ' ../../utils'
3
+ import { isSVG } from ' ../../utils'
4
4
import Spinner from ' ./Spinner.svelte'
5
5
export let size: number // px
6
6
export let icon: Promise <string > | string // svg string or url string
150
150
<div class =" placeholder-icon" />
151
151
{:then iconLoaded }
152
152
<div in:fade class =" icon" >
153
- {#if isUrl (iconLoaded )}
154
- <!-- load img url -->
155
- <img height ="100%" src ={iconLoaded } alt =" logo" />
156
- {:else }
153
+ {#if isSVG (iconLoaded )}
157
154
<!-- render svg string -->
158
155
{@html iconLoaded }
156
+ {:else }
157
+ <!-- load img url -->
158
+ <img height ="100%" src ={iconLoaded } alt =" logo" />
159
159
{/if }
160
160
</div >
161
161
{/await }
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @web3-onboard/react" ,
3
- "version" : " 2.0.1 " ,
3
+ "version" : " 2.0.2 " ,
4
4
"description" : " Collection of React Hooks for web3-onboard" ,
5
5
"module" : " dist/index.js" ,
6
6
"browser" : " dist/index.js" ,
22
22
},
23
23
"dependencies" : {
24
24
"@web3-onboard/common" : " ^2.0.1" ,
25
- "@web3-onboard/core" : " ^2.0.2 "
25
+ "@web3-onboard/core" : " ^2.0.3 "
26
26
},
27
27
"peerDependencies" : {
28
28
"react" : " ^17.0.2"
You can’t perform that action at this time.
0 commit comments