Skip to content

Commit 61bc02f

Browse files
authored
[core-v2.2.6] : Enhancement - CSS variable add (#963)
* Add css variables for connect modal border radius, box-shadow & background, wallet buttons border radius & bow shadow * Update styling for use with themes * Refine css var naming * Version bump for core
1 parent 9f069ad commit 61bc02f

File tree

6 files changed

+33
-7
lines changed

6 files changed

+33
-7
lines changed

packages/core/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,15 @@ The Onboard styles can customized via [CSS variables](https://developer.mozilla.
487487
--onboard-wallet-button-background-hover
488488
--onboard-wallet-button-color
489489
--onboard-wallet-button-border-color
490+
--onboard-wallet-button-border-radius
491+
--onboard-wallet-button-box-shadow
490492
--onboard-wallet-app-icon-border-color
491493

494+
/* CUSTOMIZE THE CONNECT MODAL */
495+
--onboard-modal-border-radius
496+
--onboard-modal-backdrop
497+
--onboard-modal-box-shadow
498+
492499
/* FONTS */
493500
--onboard-font-family-normal: Sofia Pro;
494501
--onboard-font-family-semibold: Sofia Pro Semibold;
@@ -510,6 +517,10 @@ The Onboard styles can customized via [CSS variables](https://developer.mozilla.
510517
--onboard-spacing-5: 0.5rem;
511518

512519
/* SHADOWS */
520+
--onboard-border-radius-1: 24px;
521+
522+
/* SHADOWS */
523+
--onboard-shadow-0: none;
513524
--onboard-shadow-1: 0px 4px 12px rgba(0, 0, 0, 0.1);
514525
--onboard-shadow-2: inset 0px -1px 0px rgba(0, 0, 0, 0.1);
515526

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/core",
3-
"version": "2.2.5",
3+
"version": "2.2.6",
44
"scripts": {
55
"build": "rollup -c",
66
"dev": "rollup -c -w",

packages/core/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ function mountApp() {
184184
--spacing-6: 0.25rem;
185185
--spacing-7: 0.125rem;
186186
187+
/* BORDER RADIUS */
188+
--border-radius-1: 24px;
189+
187190
/* SHADOWS */
191+
--shadow-0: none;
188192
--shadow-1: 0px 4px 12px rgba(0, 0, 0, 0.1);
189193
--shadow-2: inset 0px -1px 0px rgba(0, 0, 0, 0.1);
190194
--shadow-3: 0px 4px 16px rgba(179, 179, 179, 0.2);
@@ -195,6 +199,9 @@ function mountApp() {
195199
--modal-right: unset;
196200
--modal-bottom: unset;
197201
--modal-left: unset;
202+
203+
/* MODAL STYLES */
204+
--modal-backdrop: rgba(0, 0, 0, 0.6);
198205
}
199206
</style>
200207
`

packages/core/src/views/connect/Sidebar.svelte

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
<style>
2121
.sidebar {
2222
padding: var(--onboard-spacing-3, var(--spacing-3));
23-
border-radius: 24px 0 0 24px;
2423
background: var(
2524
--onboard-connect-sidebar-background,
2625
var(--onboard-gray-100, var(--gray-100))

packages/core/src/views/connect/WalletButton.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,15 @@
4545
.name {
4646
margin-left: var(--onboard-spacing-4, var(--spacing-4));
4747
}
48+
49+
button.wallet-button-styling {
50+
border-radius: var(--onboard-wallet-button-border-radius, var(--border-radius-1));
51+
box-shadow: var(--onboard-wallet-button-box-shadow, var(--box-shadow-0));
52+
}
4853
</style>
4954

5055
<button
51-
class="relative justify-start"
56+
class="relative justify-start wallet-button-styling"
5257
class:connected
5358
in:fade
5459
on:click={onClick}

packages/core/src/views/shared/Modal.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
.background {
3131
width: 100vw;
3232
height: 100vh;
33-
background: rgba(0, 0, 0, 0.6);
33+
background: var(--onboard-modal-backdrop, var(--modal-backdrop));
3434
pointer-events: all;
3535
}
3636
@@ -47,11 +47,15 @@
4747
4848
.modal-overflow {
4949
overflow: hidden;
50-
border-radius: 24px;
50+
}
51+
52+
.modal-styling {
53+
border-radius: var(--onboard-modal-border-radius, var(--border-radius-1));
54+
box-shadow: var(--onboard-modal-box-shadow, var(--box-shadow-0));
5155
}
5256
5357
.modal {
54-
border-radius: 24px;
58+
border-radius: var(--onboard-modal-border-radius, var(--border-radius-1));
5559
overflow-y: auto;
5660
background: white;
5761
}
@@ -78,7 +82,7 @@
7882
>
7983
<div class="flex modal-position absolute">
8084
<div on:click|stopPropagation class="flex relative max-height">
81-
<div class="modal-overflow relative flex justify-center">
85+
<div class="modal-overflow modal-styling relative flex justify-center">
8286
<div class="modal relative">
8387
<slot />
8488
</div>

0 commit comments

Comments
 (0)