-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4b9b9b0
commit 7803089
Showing
23 changed files
with
1,089 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {html, svg} from 'lit'; | ||
|
||
export const CloseSvg = html` | ||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> | ||
${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" /> | ||
`} | ||
</svg> | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './close'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './icons'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import {LitElement, html, css} from 'lit'; | ||
import {customElement, property} from 'lit/decorators.js'; | ||
|
||
@customElement('base-modal') | ||
class Modal extends LitElement { | ||
@property({type: Boolean}) | ||
open = false; | ||
|
||
static override styles = css` | ||
.modal-container { | ||
display: block; | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
width: 100%; | ||
height: 100%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
} | ||
.modal { | ||
position: absolute; | ||
background-color: white; | ||
padding: 20px; | ||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); | ||
box-sizing: border-box; | ||
} | ||
@media (max-width: 600px) { | ||
.modal { | ||
width: 100%; | ||
border-top-left-radius: 16px; | ||
border-top-right-radius: 16px; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
} | ||
@media (min-width: 600px) { | ||
.modal { | ||
width: 400px; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
border-radius: 16px; | ||
} | ||
} | ||
`; | ||
|
||
@property({type: Function}) | ||
onClose = () => {}; | ||
|
||
override render() { | ||
if (!this.open) return html``; | ||
return html` | ||
<div class="modal-container" @click=${this.onClose}> | ||
<div class="modal"> | ||
<slot></slot> | ||
</div> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'base-modal': Modal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './base-modal'; |
49 changes: 49 additions & 0 deletions
49
packages/vanilla-wallet-kit/src/connect-button-with-modal.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import {LitElement, html, nothing} from 'lit'; | ||
import {customElement, property} from 'lit/decorators.js'; | ||
import {Theme, ThemeMode} from './wallet-kit'; | ||
|
||
@customElement('connect-button-with-modal') | ||
class ConnectButtonWithModal extends LitElement { | ||
@property({type: String}) | ||
override title = 'Connect Wallet'; | ||
|
||
@property({type: ThemeMode}) | ||
mode = ThemeMode.Light; | ||
|
||
@property({type: Theme}) | ||
theme = Theme.Default; | ||
|
||
@property({type: Boolean}) | ||
open = false; | ||
|
||
private handleOpen = () => { | ||
this.open = true; | ||
}; | ||
|
||
private handleClose = () => { | ||
this.open = false; | ||
}; | ||
|
||
override render() { | ||
return html` | ||
<div> | ||
<connect-button | ||
.title=${this.title} | ||
.mode=${this.mode} | ||
.theme=${this.theme} | ||
.onClick=${this.handleOpen} | ||
></connect-button> | ||
<connect-modal | ||
open=${this.open || nothing} | ||
.onClose=${this.handleClose} | ||
></connect-modal> | ||
</div> | ||
`; | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'connect-button-with-modal': ConnectButtonWithModal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './connect-button-with-modal'; | ||
export * from './connect-button'; | ||
export * from './connect-modal'; | ||
export * from './my-element'; | ||
export * from './components'; | ||
export * from './utils'; |
Oops, something went wrong.