Skip to content

Commit 09504ce

Browse files
authored
Bump internal version, add enter submit for ifram url, reset btn closes onboard and resets mapping (#1278)
1 parent 83005d7 commit 09504ce

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
},
4747
"type": "module",
4848
"dependencies": {
49-
"@web3-onboard/core": "^2.7.0",
50-
"@web3-onboard/injected-wallets": "^2.0.16"
49+
"@web3-onboard/core": "^2.8.4",
50+
"@web3-onboard/injected-wallets": "^2.2.3"
5151
}
5252
}

docs/src/lib/components/ThemeCustomizer.svelte

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
import { share } from 'rxjs/operators'
66
import { onMount } from 'svelte'
7+
import { object_without_properties } from 'svelte/internal';
78
89
const INFURA_ID = 'e0b15c21b7d54cd4814586334af72618'
910
const injected = injectedModule()
@@ -72,15 +73,19 @@
7273
document.querySelector('#image_drop_area').style.backgroundImage = ''
7374
uploaded_image = undefined
7475
webURL = ''
76+
resetTheme()
77+
const onboardCloseBtnVisible =
78+
document?.querySelector('body > onboard-v2')?.shadowRoot?.querySelector('.close-button')
79+
if (onboardCloseBtnVisible) onboardCloseBtnVisible?.click()
7580
}
7681
7782
const handleConnectWalletBtn = () => {
7883
!!$wallets$ && $wallets$.length
79-
? onboard.disconnectWallet({label: $wallets$[0].label})
84+
? onboard.disconnectWallet({ label: $wallets$[0].label })
8085
: onboard.connectWallet()
8186
}
8287
83-
const defaultStyling = {
88+
const baseStyles = {
8489
'--background-color': '#ffffff',
8590
'--text-color': '#1a1d26',
8691
'--border-color': '#ebebed',
@@ -90,6 +95,8 @@
9095
'--secondary-text-color': '#707481'
9196
}
9297
98+
let defaultStyling = {...baseStyles}
99+
93100
const baseStyling = `--onboard-connect-sidebar-background: var(--accent-background);
94101
--onboard-close-button-background: var(--accent-background);
95102
--onboard-connect-sidebar-color: var(--text-color);
@@ -119,12 +126,19 @@
119126
120127
let copyableStyles = `:root {\n ${styleToString(defaultStyling)}${baseStyling}\n}`
121128
122-
const updateThemes = (e, targetStyle) => {
129+
const updateTheme = (e, targetStyle) => {
123130
document.documentElement.style.setProperty(targetStyle, e.target.value)
124131
125132
copyableStyles = `:root {\n ${styleToString(defaultStyling)}${baseStyling}\n}`
126133
}
127134
135+
const resetTheme = () => {
136+
defaultStyling = {...baseStyles}
137+
Object.keys(defaultStyling).forEach(style => {
138+
document.documentElement.style.setProperty(style, defaultStyling[style])
139+
})
140+
}
141+
128142
let checked = false
129143
130144
const handleBackdrop = () => {
@@ -184,7 +198,7 @@
184198
type="color"
185199
name="Theme"
186200
bind:value={defaultStyling[target]}
187-
on:input={(e) => updateThemes(e, target)}
201+
on:input={(e) => updateTheme(e, target)}
188202
/>
189203
</div>
190204
<span class="text" id="current-theme">{target} : {defaultStyling[target]}</span>
@@ -206,7 +220,7 @@
206220
</div>
207221
<div class="image-drop-container">
208222
<div id="image_drop_area">
209-
<div class="drop-area-controls">
223+
<form class="drop-area-controls" on:submit|preventDefault={addURLToIFrame}>
210224
<div>
211225
Enter your website url or drag and drop a screenshot to preview web3-onboard on your site
212226
</div>
@@ -228,7 +242,7 @@
228242
>{!!$wallets$ && $wallets$.length ? 'Disconnect Wallet' : 'Connect Wallet'}</button
229243
>
230244
</div>
231-
</div>
245+
</form>
232246
<iframe
233247
id="iframe_underlay"
234248
title="iframe area for testing W3O with your app"

0 commit comments

Comments
 (0)