Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
112 commits
Select commit Hold shift + click to select a range
6aef11c
Added theming updates to cover not dark mode mode
Adamj1232 Dec 16, 2022
7e117d0
Refine theme types, add actions to set themes through API, add valida…
Adamj1232 Dec 19, 2022
2cbe110
updated layout further
Adamj1232 Dec 20, 2022
3c12dc1
Remove docs files not needed
Adamj1232 Dec 20, 2022
f76ef81
Merge branch 'v2-web3-onboard-develop' into feature/not-dark-mode-mode
Adamj1232 Dec 20, 2022
222699c
Merge in develop
Adamj1232 Dec 20, 2022
5cae596
Cleanup and fixes
Adamj1232 Dec 20, 2022
f9f13b6
Notify matching theme
Adamj1232 Dec 20, 2022
e13817a
Light mode looking good on notify
Adamj1232 Dec 20, 2022
0b7f732
Further refined tooling and themes
Adamj1232 Dec 20, 2022
8404ce9
Merge in develop
Adamj1232 Dec 20, 2022
97fd562
TP now works with themes, updated default behavior
Adamj1232 Dec 20, 2022
2b8d9fc
Update handling of theme types
Adamj1232 Dec 21, 2022
41527a5
restore changes to indicator
gesquinca Dec 21, 2022
1c86e10
Update Icon usage
Adamj1232 Dec 21, 2022
024960a
Merge branch 'feature/not-dark-mode-mode' of https://github.com/block…
gesquinca Dec 21, 2022
4d9d5e7
update blocknative-icon svg
gesquinca Dec 21, 2022
de7e653
re-org and rename icon imports
gesquinca Dec 21, 2022
3cd2e30
remove hover states from mobile
gesquinca Dec 21, 2022
d43a39f
Update packages to reflect fillColor icon use of css variable theming
Adamj1232 Dec 21, 2022
823a884
updates
Adamj1232 Dec 21, 2022
643dd61
Minor fixups and functionality tightening
Adamj1232 Dec 21, 2022
32c12bb
Refactor logic for handling theme updates
Adamj1232 Dec 21, 2022
d21a7a1
poc theming work
gesquinca Dec 21, 2022
595a886
update close button to use only current text color
gesquinca Jan 4, 2023
3fb16c2
Merge in develop and fix conflicts
Adamj1232 Jan 5, 2023
90f1b1e
Merge develop and handle conflicts
Adamj1232 Jan 6, 2023
55a9ea7
Update Account Select to use theming
Adamj1232 Jan 6, 2023
9680dfd
Merge branch 'feature/not-dark-mode-mode' into feature/ge-theming-upd…
gesquinca Jan 6, 2023
5a12dbf
update minimized ac component
gesquinca Jan 6, 2023
5aa95d8
update micro ac component
gesquinca Jan 7, 2023
0757892
add new theming variables to account center expanded component
gesquinca Jan 10, 2023
6cf0dfa
remove blue check from dapp info area
gesquinca Jan 10, 2023
a193779
Merge in develop
Adamj1232 Jan 11, 2023
3eed255
Add system option and check to theming
Adamj1232 Jan 11, 2023
fdc83cf
account center expanded tweaks
gesquinca Jan 11, 2023
ac0305d
update WalletRow component
gesquinca Jan 11, 2023
ddb86df
add z-index to bg hover element
gesquinca Jan 11, 2023
f69dafd
Merge in latest dev
Adamj1232 Jan 12, 2023
d778f81
Updating theme customizer in docs
Adamj1232 Jan 13, 2023
79a4744
add fallback legacy variables for connect modal
gesquinca Jan 17, 2023
22259d6
Merge in dev
Adamj1232 Jan 17, 2023
e806ecb
add legacy variable fallbacks to account center
gesquinca Jan 17, 2023
957558c
Merge branch 'feature/not-dark-mode-mode' into feature/ge-theming-upd…
gesquinca Jan 17, 2023
1428cbb
correct app name spacing
gesquinca Jan 17, 2023
26f9704
Update theme customizer
Adamj1232 Jan 17, 2023
ee3648e
Update zindex of theming tool to avoid clash with docs themer
Adamj1232 Jan 17, 2023
70c0102
add legacy variable override to closebutton
gesquinca Jan 17, 2023
e412b12
update app-name styles
gesquinca Jan 17, 2023
39c0d17
remove comment for action color
gesquinca Jan 17, 2023
00d1018
Fix ternary in handling mobile
Adamj1232 Jan 17, 2023
2681068
Cleanup defaults
Adamj1232 Jan 17, 2023
b8a0f76
add font family override for AC button
gesquinca Jan 17, 2023
997e766
Merge branch 'v2-web3-onboard-develop' into feature/not-dark-mode-mode
Adamj1232 Jan 17, 2023
52a9dd1
update WalletRow
gesquinca Jan 17, 2023
93968b1
Merge branch 'feature/not-dark-mode-mode' into feature/ge-theming-upd…
gesquinca Jan 17, 2023
eabca39
Fix validation
Adamj1232 Jan 17, 2023
4ab4ae1
Fix validation for theming
Adamj1232 Jan 17, 2023
6c4d1fb
Update copiable theming code from customizer
Adamj1232 Jan 17, 2023
ecc9a66
remove comments
gesquinca Jan 18, 2023
a829a1c
fix network select color issue
gesquinca Jan 18, 2023
22fe51f
add back border-bottom for mobile designs
gesquinca Jan 19, 2023
46c7326
update theming variables names and values
gesquinca Jan 19, 2023
6bcc858
fix WalletRow z-index issue
gesquinca Jan 19, 2023
fc08ff7
update theme var names and set new default values
gesquinca Jan 19, 2023
018db90
update connect modal
gesquinca Jan 19, 2023
e257fde
update notify border
gesquinca Jan 19, 2023
bfc8a09
update transaction preview components
gesquinca Jan 19, 2023
b4cc1a6
Merge branch 'feature/not-dark-mode-mode' into feature/ge-theming-upd…
gesquinca Jan 19, 2023
0218e47
update notify and transaction-preview
gesquinca Jan 19, 2023
48445b3
Merge in develop
Adamj1232 Jan 19, 2023
cd84076
Merge branch 'feature/not-dark-mode-mode' into feature/ge-theming-upd…
Adamj1232 Jan 19, 2023
e1b175c
Refactor functionality and cleanup logic
Adamj1232 Jan 19, 2023
a00b555
Ready for testing
Adamj1232 Jan 19, 2023
4c77b22
Fix up themeing tool in docs
Adamj1232 Jan 19, 2023
4a96e97
merge develop
Adamj1232 Jan 20, 2023
20af79d
Add custom theming option, enable account center
Adamj1232 Jan 20, 2023
95f45e1
remove --w3o-tp variables from transaction preview components
gesquinca Jan 20, 2023
edb48b6
Merge branch 'feature/ge-theming-updates' of https://github.com/block…
gesquinca Jan 20, 2023
87c5ab0
Merge in develop
Adamj1232 Jan 20, 2023
a51437e
Remove mock transaction code
Adamj1232 Jan 20, 2023
c827d94
Add theming docs
Adamj1232 Jan 20, 2023
d904b82
small tweaks to theme customizer
gesquinca Jan 20, 2023
45e1319
Merge branch 'feature/ge-theming-updates' of https://github.com/block…
gesquinca Jan 20, 2023
705d8f4
add border-radius theme var to connect and account-center
gesquinca Jan 21, 2023
98231eb
update indicators to use action-color theme var
gesquinca Jan 21, 2023
53ae0b1
update default box-shadow color
gesquinca Jan 21, 2023
5b4ec95
Refine ts and README notes around theming
Adamj1232 Jan 23, 2023
83d1977
Update docs/src/lib/components/ThemeCustomizer.svelte
Adamj1232 Jan 23, 2023
ac891fe
Update packages/transaction-preview/src/views/Maximized.svelte
Adamj1232 Jan 23, 2023
7e68ab6
Clean up demo
Adamj1232 Jan 23, 2023
67f115a
Update packages/core/src/views/account-center/WalletRow.svelte
Adamj1232 Jan 23, 2023
5e9b43c
Update packages/transaction-preview/src/views/Maximized.svelte
Adamj1232 Jan 23, 2023
d6fe8d8
Update packages/core/src/views/account-center/WalletRow.svelte
Adamj1232 Jan 23, 2023
74b3075
Fix handling of custom theme in theme customizer
Adamj1232 Jan 23, 2023
8876340
Add quickstart options to README and docs for all examples we have av…
Adamj1232 Jan 23, 2023
cc4c46f
Fix up docs layout
Adamj1232 Jan 23, 2023
3e91e07
Cleanup readme
Adamj1232 Jan 23, 2023
6530659
Add svelte example to options list
Adamj1232 Jan 23, 2023
1bbf211
Fix up core docs
Adamj1232 Jan 23, 2023
fbedd28
hook up hardware wallet components to theme vars
gesquinca Jan 23, 2023
4095d40
Update poweredBy svg var
Adamj1232 Jan 23, 2023
a4f2f4c
Update poweredBy svg var
Adamj1232 Jan 23, 2023
d31cfb3
Handle merge conflicts from develop
Adamj1232 Jan 24, 2023
bef0698
Fix sidebar theming
Adamj1232 Jan 24, 2023
9577bfc
Add rxjs handling to event listener
Adamj1232 Jan 24, 2023
01ef50b
update poweredby and default icon graphics
gesquinca Jan 24, 2023
87c8013
Merge branch 'feature/ge-theming-updates' of https://github.com/block…
gesquinca Jan 24, 2023
b763937
remove unused svg files
gesquinca Jan 24, 2023
ffbc7ec
Remove behavior subject
Adamj1232 Jan 25, 2023
3be205d
ignore to keystone AirGapped type issue
Adamj1232 Jan 25, 2023
6953479
Handle issue for readme
Adamj1232 Jan 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ If you would like to test out the current functionality of V2 in a small browser
- Checkout the V2 feature branch: `git checkout v2-web3-onboard`
- Install the dependencies: `yarn` (if running a M1 mac - `yarn install-m1-mac`)
- Run all packages in dev mode: `yarn dev`
- [View demo app in the browser](http://localhost:8080)
- To view the demo app in the browser after running the above steps navigate to [http://localhost:8080](http://localhost:8080)
274 changes: 174 additions & 100 deletions docs/src/lib/components/ThemeCustomizer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,60 @@
rpcUrl: `https://mainnet.infura.io/v3/${INFURA_ID}`
},
{
id: '0x3',
token: 'tROP',
label: 'Ethereum Ropsten Testnet',
rpcUrl: `https://ropsten.infura.io/v3/${INFURA_ID}`
id: '0x5',
token: 'ETH',
label: 'Ethereum Goerli Testnet',
rpcUrl: `https://goerli.infura.io/v3/${INFURA_ID}`
},
{
id: '0x13881',
token: 'MATIC',
label: 'Polygon - Mumbai',
rpcUrl: 'https://matic-mumbai.chainstacklabs.com '
},
{
id: '0x38',
token: 'BNB',
label: 'Binance',
rpcUrl: 'https://bsc-dataseed.binance.org/'
},
{
id: 137,
token: 'MATIC',
label: 'Polygon',
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
},
{
id: 10,
token: 'OETH',
label: 'Optimism',
rpcUrl: 'https://mainnet.optimism.io'
},
{
id: 42161,
token: 'ARB-ETH',
label: 'Arbitrum',
rpcUrl: 'https://rpc.ankr.com/arbitrum'
}
],
appMetadata: {
name: 'Documentation',
icon: '<svg></svg>',
description: 'Example showcasing how to connect a wallet.',
recommendedInjectedWallets: [
{ name: 'MetaMask', url: 'https://metamask.io' },
{ name: 'Coinbase', url: 'https://wallet.coinbase.com/' }
]
},
accountCenter: {
desktop: { enabled: false },
mobile: { enabled: false }
}
desktop: { enabled: true },
mobile: { enabled: true }
},
theme: 'system'
})

const themes = ['system', 'default', 'light', 'dark', 'custom']
let selectedTheme = 'system'

// Subscribe to wallet updates
const wallets$ = onboard.state.select('wallets').pipe(share())

Expand Down Expand Up @@ -73,8 +106,9 @@
uploaded_image = undefined
webURL = ''
resetTheme()
const onboardCloseBtnVisible =
document?.querySelector('body > onboard-v2')?.shadowRoot?.querySelector('.close-button')
const onboardCloseBtnVisible = document
?.querySelector('body > onboard-v2')
?.shadowRoot?.querySelector('.close-button')
if (onboardCloseBtnVisible) onboardCloseBtnVisible?.click()
}

Expand All @@ -84,34 +118,43 @@
: onboard.connectWallet()
}

const baseStyles = {
'--background-color': '#ffffff',
'--text-color': '#1a1d26',
'--border-color': '#ebebed',
'--accent-background': '#ebebed',
'--accent-color': '#929bed',
'--accent-color-hover': '#eff1fc',
'--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);
--onboard-connect-sidebar-progress-background: var(--secondary-text-color);
--onboard-connect-sidebar-progress-color: var(--accent-color);
--onboard-connect-header-background: var(--background-color);
--onboard-connect-header-color: var(--text-color);
--onboard-main-scroll-container-background: var(--background-color);
--onboard-link-color: var(--accent-color);
--onboard-wallet-button-background: var(--background-color);
--onboard-wallet-button-background-hover: var(--accent-color-hover);
--onboard-wallet-button-border-color: var(--border-color);
--onboard-wallet-app-icon-border-color: var(--border-color);`
const themingObjects = {
default: {
'--w3o-background-color': 'unset',
'--w3o-foreground-color': 'unset',
'--w3o-text-color': 'unset',
'--w3o-border-color': 'unset',
'--w3o-action-color': 'unset',
'--w3o-border-radius': 'unset'
},
custom: {
'--w3o-background-color': 'unset',
'--w3o-foreground-color': 'unset',
'--w3o-text-color': 'unset',
'--w3o-border-color': 'unset',
'--w3o-action-color': 'unset',
'--w3o-border-radius': 'unset'
},
light: {
'--w3o-background-color': '#ffffff',
'--w3o-foreground-color': '#EFF1FC',
'--w3o-text-color': '#1a1d26',
'--w3o-border-color': '#d0d4f7',
'--w3o-action-color': '#6370E5',
'--w3o-border-radius': '16px'
},
dark: {
'--w3o-background-color': '#1A1D26',
'--w3o-foreground-color': '#242835',
'--w3o-text-color': '#EFF1FC',
'--w3o-border-color': '#33394B',
'--w3o-action-color': '#929bed',
'--w3o-border-radius': '16px'
}
}

const styleToString = (style) => {
return Object.keys(style).reduce((acc, key) => acc + key + ': ' + style[key] + '; \n ', '')
return Object.keys(style).reduce((acc, key) => acc + `"${key}": "${style[key]}", \n`, '')
}

async function copyStylingConfig() {
Expand All @@ -123,18 +166,28 @@
}
}

let copyableStyles = `:root {\n ${styleToString(defaultStyling)}${baseStyling}\n}`
let copyableStyles =
selectedTheme !== 'custom' ? '' : `{\n ${styleToString(themingObjects[selectedTheme])}}`

const updateTheme = () => {
selectedTheme !== 'custom'
? onboard.state.actions.updateTheme(selectedTheme)
: onboard.state.actions.updateTheme('default')
copyableStyles =
selectedTheme !== 'custom' ? '' : `{\n ${styleToString(themingObjects[selectedTheme])}}`
}

const updateTheme = (e, targetStyle) => {
const updateThemeEl = (e, targetStyle) => {
if (selectedTheme !== 'custom') return
document.documentElement.style.setProperty(targetStyle, e.target.value)

copyableStyles = `:root {\n ${styleToString(defaultStyling)}${baseStyling}\n}`
copyableStyles = `{\n ${styleToString(themingObjects[selectedTheme])}}`
}

const resetTheme = () => {
defaultStyling = {...baseStyles}
Object.keys(defaultStyling).forEach(style => {
document.documentElement.style.setProperty(style, defaultStyling[style])
selectedTheme = 'custom'
Object.keys(themingObjects['custom']).forEach((style) => {
document.documentElement.style.setProperty(style, themingObjects['custom'][style])
})
}

Expand Down Expand Up @@ -187,28 +240,66 @@

<section>
<div class="control-panel">
<label for="Theme">Click Color Circles to Set Theme: </label>
<hr />
<div class="theming-container">
{#each Object.keys(defaultStyling) as target}
<div class="theming-inputs-wrapper">
<div class="theming-inputs">
<input
type="color"
name="Theme"
bind:value={defaultStyling[target]}
on:input={(e) => updateTheme(e, target)}
/>
</div>
<span class="text" id="current-theme">{target} : {defaultStyling[target]}</span>
</div>
<label>Select a theme:</label>
<select bind:value={selectedTheme} on:change={() => updateTheme()}>
{#each themes as theme}
<option value={theme}>
{theme}
</option>
{/each}
</div>
<div class="copy-styles-container">
<textarea readonly bind:value={copyableStyles} rows="10" class="copy-styles-textarea" />
<button on:click={async () => await copyStylingConfig()}> Copy Styling Config </button>
</div>
<hr />
</select>
{#if selectedTheme === 'custom'}
<label for="Theme"
>Click Color Circles to Customize Theme, Copy Config and Paste as `theme` property value in
Onboard config:
</label>
<hr />
<div class="theming-container">
{#each Object.keys(themingObjects[selectedTheme]) as target}
{#if !target.includes('border-radius')}
<div class="theming-inputs-wrapper">
<div class="theming-inputs">
<input
type="color"
name="Theme"
bind:value={themingObjects[selectedTheme][target]}
on:input={(e) => updateThemeEl(e, target)}
/>
</div>
<span class="text" id="current-theme"
>{target} : {themingObjects[selectedTheme][target]}</span
>
</div>
{:else}
<div class="theming-inputs-wrapper">
<div class="theming-inputs-text">
<input
class="br-text-input"
type="text"
bind:value={themingObjects[selectedTheme][target]}
on:input={(e) => updateThemeEl(e, target)}
/>
</div>
<span class="text" id="current-theme"
>{target} : {themingObjects[selectedTheme][target]}</span
>
</div>
{/if}
{/each}
</div>
<div class="copy-styles-container">
<textarea readonly bind:value={copyableStyles} rows="8" class="copy-styles-textarea" />
<button on:click={async () => await copyStylingConfig()}> Copy Theming Config </button>
</div>
<hr />
{:else}
<label for="Theme">
The system theme will align the theme with the users system preferences
</label>
<hr />
<div class="theming-container" />
{/if}

<div class="backdrop-toggle">
<label class="switch">
<input type="checkbox" on:change={() => handleBackdrop()} bind:checked />
Expand Down Expand Up @@ -255,40 +346,6 @@
</section>

<style>
/* iframe { width: 100%; height: 62.5rem;} */
:root {
--background-color: #ffffff; /* --white */
--text-color: #1a1d26; /* --gray-700 */
--border-color: #ebebed; /* --gray-100 taken from future mock */

--accent-background: #ebebed; /* --gray-100 (currently gray-100 in connect modal) */
--accent-color: #929bed; /* --primary-400 */
--accent-color-hover: #eff1fc; /* --primary-200 */

/* Account Center & Notify */
--secondary-text-color: #707481; /* --gray-400 (balance and token name) */
/* --secondary-accent-background: #242835; --gray-600 (Upper background in maximized) */

/* --onboard-font-family-normal: System,monospace; */
--onboard-connect-sidebar-background: var(--accent-background);
--onboard-close-button-background: var(--accent-background);
--onboard-connect-sidebar-color: var(--text-color);
--onboard-connect-sidebar-progress-background: var(
--secondary-text-color
); /* defaults to gray-200 */
--onboard-connect-sidebar-progress-color: var(--accent-color); /* defaults to primary-600 */
--onboard-connect-header-background: var(--background-color);
--onboard-connect-header-color: var(--text-color);
--onboard-main-scroll-container-background: var(--background-color);
--onboard-link-color: var(--accent-color);
--onboard-wallet-button-background: var(--background-color);
--onboard-wallet-button-background-hover: var(--accent-color-hover);
--onboard-wallet-button-color-hover: var(--text-color);
--onboard-wallet-button-color: var(--text-color);
--onboard-wallet-button-border-color: var(--border-color);
--onboard-wallet-app-icon-border-color: var(--border-color);
}

section {
position: relative;
height: 100%;
Expand All @@ -315,9 +372,9 @@
}

.control-panel {
z-index: 9999;
left: auto;
right: 0;
z-index: 25;
left: 0;
right: auto;
bottom: 0;
position: fixed;
overflow: hidden;
Expand Down Expand Up @@ -368,6 +425,18 @@
height: 2em;
margin: 0.5em;
}
.theming-inputs-text {
display: inline-flex;
align-items: center;
justify-content: center;
height: 2em;
margin: 0.25em;
}
.br-text-input {
width: 3rem;
padding: 0.25rem;
text-align: center;
}
.iframe-input {
flex: 1;
padding: 1rem;
Expand Down Expand Up @@ -503,6 +572,11 @@
transform: translateX(26px);
}

select {
width: 100%;
padding: 1rem;
}

.backdrop-toggle {
display: flex;
align-items: center;
Expand Down
Loading