Skip to content

Commit

Permalink
Bump internal version, add enter submit for ifram url, reset btn clos…
Browse files Browse the repository at this point in the history
…es onboard and resets mapping (#1278)
  • Loading branch information
Adamj1232 authored Sep 21, 2022
1 parent 83005d7 commit 09504ce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"type": "module",
"dependencies": {
"@web3-onboard/core": "^2.7.0",
"@web3-onboard/injected-wallets": "^2.0.16"
"@web3-onboard/core": "^2.8.4",
"@web3-onboard/injected-wallets": "^2.2.3"
}
}
26 changes: 20 additions & 6 deletions docs/src/lib/components/ThemeCustomizer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import { share } from 'rxjs/operators'
import { onMount } from 'svelte'
import { object_without_properties } from 'svelte/internal';
const INFURA_ID = 'e0b15c21b7d54cd4814586334af72618'
const injected = injectedModule()
Expand Down Expand Up @@ -72,15 +73,19 @@
document.querySelector('#image_drop_area').style.backgroundImage = ''
uploaded_image = undefined
webURL = ''
resetTheme()
const onboardCloseBtnVisible =
document?.querySelector('body > onboard-v2')?.shadowRoot?.querySelector('.close-button')
if (onboardCloseBtnVisible) onboardCloseBtnVisible?.click()
}
const handleConnectWalletBtn = () => {
!!$wallets$ && $wallets$.length
? onboard.disconnectWallet({label: $wallets$[0].label})
? onboard.disconnectWallet({ label: $wallets$[0].label })
: onboard.connectWallet()
}
const defaultStyling = {
const baseStyles = {
'--background-color': '#ffffff',
'--text-color': '#1a1d26',
'--border-color': '#ebebed',
Expand All @@ -90,6 +95,8 @@
'--secondary-text-color': '#707481'
}
let defaultStyling = {...baseStyles}
const baseStyling = `--onboard-connect-sidebar-background: var(--accent-background);
--onboard-close-button-background: var(--accent-background);
--onboard-connect-sidebar-color: var(--text-color);
Expand Down Expand Up @@ -119,12 +126,19 @@
let copyableStyles = `:root {\n ${styleToString(defaultStyling)}${baseStyling}\n}`
const updateThemes = (e, targetStyle) => {
const updateTheme = (e, targetStyle) => {
document.documentElement.style.setProperty(targetStyle, e.target.value)
copyableStyles = `:root {\n ${styleToString(defaultStyling)}${baseStyling}\n}`
}
const resetTheme = () => {
defaultStyling = {...baseStyles}
Object.keys(defaultStyling).forEach(style => {
document.documentElement.style.setProperty(style, defaultStyling[style])
})
}
let checked = false
const handleBackdrop = () => {
Expand Down Expand Up @@ -184,7 +198,7 @@
type="color"
name="Theme"
bind:value={defaultStyling[target]}
on:input={(e) => updateThemes(e, target)}
on:input={(e) => updateTheme(e, target)}
/>
</div>
<span class="text" id="current-theme">{target} : {defaultStyling[target]}</span>
Expand All @@ -206,7 +220,7 @@
</div>
<div class="image-drop-container">
<div id="image_drop_area">
<div class="drop-area-controls">
<form class="drop-area-controls" on:submit|preventDefault={addURLToIFrame}>
<div>
Enter your website url or drag and drop a screenshot to preview web3-onboard on your site
</div>
Expand All @@ -228,7 +242,7 @@
>{!!$wallets$ && $wallets$.length ? 'Disconnect Wallet' : 'Connect Wallet'}</button
>
</div>
</div>
</form>
<iframe
id="iframe_underlay"
title="iframe area for testing W3O with your app"
Expand Down

1 comment on commit 09504ce

@vercel
Copy link

@vercel vercel bot commented on 09504ce Sep 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.