Skip to content

Commit

Permalink
feat: create modal and button with vanilla js
Browse files Browse the repository at this point in the history
  • Loading branch information
davidecarpini committed Oct 31, 2023
1 parent 7803089 commit 9b9b7b2
Show file tree
Hide file tree
Showing 31 changed files with 393 additions and 386 deletions.
7 changes: 3 additions & 4 deletions apps/sample-vanilla-app/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<!DOCTYPE html>

<html>
<html lang="en">
<head>
<title>Sample Vanilla App</title>
<meta charset="utf-8" />
<script crossorigin type="module" src="index.js"></script>
<style>
Expand All @@ -12,8 +13,6 @@
</style>
</head>
<body>
<connect-button>
<p>This is child content</p>
</connect-button>
<vwk-connect-button-with-modal></vwk-connect-button-with-modal>
</body>
</html>
6 changes: 6 additions & 0 deletions apps/sample-vanilla-app/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
import '@vechain/vanilla-wallet-kit';

// eslint-disable-next-line no-undef
addEventListener('vwk-source-card-clicked', (e) => {
// eslint-disable-next-line no-console
console.log('vwk-source-card-clicked', e.detail);
});
6 changes: 3 additions & 3 deletions packages/vanilla-wallet-kit/index.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<!DOCTYPE html>

<html>
<html lang="en">
<head>
<title>Connect</title>
<meta charset="utf-8" />
<script src="./node_modules/lit/polyfill-support.js"></script>
<script type="module" src="./dist/index.js"></script>
</head>
<body>
<connect-button-with-modal mode="dark"></connect-button-with-modal>
<vwk-connect-button-with-modal mode="DARK"></vwk-connect-button-with-modal>
</body>
</html>
7 changes: 3 additions & 4 deletions packages/vanilla-wallet-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@
"watch": "tsc --watch"
},
"dependencies": {
"@wagmi/core": "^1.4.5",
"@web3modal/wagmi": "^3.2.0",
"lit": "^3.0.0",
"viem": "^1.18.1"
"@web3modal/ethers5": "^3.2.0",
"ethers": "5.7.2",
"lit": "^3.0.0"
},
"devDependencies": {
"@11ty/eleventy": "^1.0.1",
Expand Down
15 changes: 11 additions & 4 deletions packages/vanilla-wallet-kit/src/assets/icons/close.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
import {html, svg} from 'lit';

export const CloseSvg = html`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
${svg`
export const CloseSvg = svg`
<path
d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" />
`}
`;

export const LightCloseSvg = html`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#777777">
${CloseSvg}
</svg>
`;
export const DarkCloseSvg = html`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="#999999">
${CloseSvg}
</svg>
`;
4 changes: 4 additions & 0 deletions packages/vanilla-wallet-kit/src/assets/images/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export * from './sync';
export * from './sync2';
export * from './wallet-connect';
export * from './veworld';
2 changes: 2 additions & 0 deletions packages/vanilla-wallet-kit/src/assets/images/sync.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/vanilla-wallet-kit/src/assets/images/sync2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const Sync2Logo = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABAAAAAIACAIAAACTr4nuAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAALEwAACxMBAJqcGAAAHepJREFUeJzt3VFoXXeeH/B/pKtFusTrbexGE2yIdrQxE0yiNlBfYzoPHieFDGUKZrKwHtKksGYZCHFZil9CQJDmxW82gVK8D8kGHOhAlrYLMXWczMsayw8GJ4RQb71VSNRFicNuKuZKdK4mfTjW9ZV0ryzp3nPP/5z/5/NgZNmWjvXwO7/v7///n/NQmHkvAAAAaRgp+gIAAIDhEQAAACAhAgAAACREAAAAgIQIAAAAkBABAAAAEiIAAABAQgQAAABIiAAAAAAJEQAAACAhAgAAAC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AAICECAAAAJAQAQAAABIiAAAAQEIEAAAASIgAAAAACREAAAAgIQIAAAAkRAAAAICECAAAAJAQAQAAABIiAAAAQEIEAAAASMj/B4L8aNBJ/TkUAAAAAElFTkSuQmCC`;
1 change: 1 addition & 0 deletions packages/vanilla-wallet-kit/src/assets/images/veworld.ts

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/vanilla-wallet-kit/src/assets/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './icons';
export * from './images';
1 change: 1 addition & 0 deletions packages/vanilla-wallet-kit/src/components/base/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './vwk-base-modal';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './vwk-base-modal';
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {Colors, Theme, ThemeMode} from '../../../wallet-kit';

@customElement('base-modal')
@customElement('vwk-base-modal')
class Modal extends LitElement {
@property({type: Boolean})
open = false;
Expand All @@ -21,12 +22,20 @@ class Modal extends LitElement {
.modal {
position: absolute;
background-color: white;
padding: 20px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
box-sizing: border-box;
}
.modal.LIGHT {
background-color: ${Colors.White};
color: ${Colors.Dark};
}
.modal.DARK {
background-color: ${Colors.Dark};
color: ${Colors.LightGray};
}
@media (max-width: 600px) {
.modal {
width: 100%;
Expand All @@ -40,7 +49,7 @@ class Modal extends LitElement {
@media (min-width: 600px) {
.modal {
width: 400px;
width: 350px;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
Expand All @@ -52,11 +61,24 @@ class Modal extends LitElement {
@property({type: Function})
onClose = () => {};

stopPropagation = (event: Event) => {
event.stopPropagation();
};

@property()
mode = ThemeMode.Light;

@property()
theme = Theme.Default;

override render() {
if (!this.open) return html``;
return html`
<div class="modal-container" @click=${this.onClose}>
<div class="modal">
<div
class="modal ${this.mode} ${this.theme}"
@click=${this.stopPropagation}
>
<slot></slot>
</div>
</div>
Expand All @@ -66,6 +88,6 @@ class Modal extends LitElement {

declare global {
interface HTMLElementTagNameMap {
'base-modal': Modal;
'vwk-base-modal': Modal;
}
}
6 changes: 5 additions & 1 deletion packages/vanilla-wallet-kit/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
export * from './base-modal';
export * from './base';
export * from './vwk-connect-modal';
export * from './vwk-connect-button';
export * from './vwk-connect-button-with-modal';
export * from './vwk-fonts';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './vwk-connect-button-with-modal';
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {LitElement, html, nothing} from 'lit';
import {LitElement, html} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {Theme, ThemeMode} from './wallet-kit';
import {SourceInfo, Theme, ThemeMode} from '../../wallet-kit';

@customElement('connect-button-with-modal')
@customElement('vwk-connect-button-with-modal')
class ConnectButtonWithModal extends LitElement {
@property({type: String})
override title = 'Connect Wallet';
Expand All @@ -16,6 +16,9 @@ class ConnectButtonWithModal extends LitElement {
@property({type: Boolean})
open = false;

@property({type: Function})
onSourceClick?: (source?: SourceInfo) => {} = undefined;

private handleOpen = () => {
this.open = true;
};
Expand All @@ -27,23 +30,27 @@ class ConnectButtonWithModal extends LitElement {
override render() {
return html`
<div>
<connect-button
<vwk-fonts></vwk-fonts>
<vwk-connect-button
.title=${this.title}
.mode=${this.mode}
.theme=${this.theme}
.onClick=${this.handleOpen}
></connect-button>
<connect-modal
open=${this.open || nothing}
></vwk-connect-button>
<vwk-connect-modal
.mode=${this.mode}
.theme=${this.theme}
.open=${this.open}
.onClose=${this.handleClose}
></connect-modal>
.onSourceClick=${this.onSourceClick}
></vwk-connect-modal>
</div>
`;
}
}

declare global {
interface HTMLElementTagNameMap {
'connect-button-with-modal': ConnectButtonWithModal;
'vwk-connect-button-with-modal': ConnectButtonWithModal;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './vwk-connect-button';
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {Theme, ThemeMode, Colors} from './wallet-kit';
import {Theme, ThemeMode, Colors} from '../../wallet-kit';

@customElement('connect-button')
export class ConnectButton extends LitElement {
@customElement('vwk-connect-button')
class ConnectButton extends LitElement {
static override styles = css`
button {
cursor: pointer;
display: block;
border: none;
border-radius: 20px;
border-radius: 12px;
padding: 8px 12px;
font-family: 'Inter', sans-serif;
}
button:hover {
opacity: 0.9;
}
button.light {
button.LIGHT {
background-color: ${Colors.LightGray};
color: ${Colors.Dark};
}
button.dark {
button.DARK {
background-color: ${Colors.Dark};
color: ${Colors.LightGray};
}
Expand Down Expand Up @@ -49,6 +50,6 @@ export class ConnectButton extends LitElement {

declare global {
interface HTMLElementTagNameMap {
'connect-button': ConnectButton;
'vwk-connect-button': ConnectButton;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './vwk-connect-modal';
export * from './vwk-source-card';
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import {LitElement, html, css} from 'lit';
import {customElement, property} from 'lit/decorators.js';
import {DarkCloseSvg, LightCloseSvg} from '../../assets';
import {SourceInfo, Theme, ThemeMode, WalletSources} from '../../wallet-kit';

@customElement('vwk-connect-modal')
class ConnectModal extends LitElement {
static override styles = css`
.modal-container {
padding: 20px;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding-bottom: 10px;
font-family: 'Inter', sans-serif;
}
.modal-body {
flex-direction: column;
}
.close-icon {
cursor: pointer;
width: 20px;
height: 20px;
}
`;

@property({type: Boolean})
open = false;

@property({type: Function})
onClose = () => {};

@property({type: Function})
onSourceClick?: (source?: SourceInfo) => {} = undefined;

@property()
mode = ThemeMode.Light;

@property()
theme = Theme.Default;

override render() {
return html`
<vwk-fonts></vwk-fonts>
<vwk-base-modal
.open=${this.open}
.onClose=${this.onClose}
.mode=${this.mode}
.theme=${this.theme}
>
<div class="modal-container">
<div class="modal-header">
<div></div>
<div>Connect Wallet</div>
<div class="close-icon" @click=${this.onClose}>
${this.mode == ThemeMode.Light ? LightCloseSvg : DarkCloseSvg}
</div>
</div>
<div class="modal-body">
${WalletSources.map(
(source) =>
html`<vwk-source-card
.source=${source}
.mode=${this.mode}
.onClick=${this.onSourceClick}
></vwk-source-card>`
)}
</div>
</div>
</vwk-base-modal>
`;
}
}

declare global {
interface HTMLElementTagNameMap {
'vwk-connect-modal': ConnectModal;
}
}
Loading

0 comments on commit 9b9b7b2

Please sign in to comment.