-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added custom wallet and default wallet logic, added modal component
- Loading branch information
1 parent
aaf58ef
commit 068a74c
Showing
10 changed files
with
181 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +0,0 @@ | ||
.Modal { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.25); | ||
display: flex; | ||
} | ||
|
||
.Modal .Modal-content { | ||
max-width: 700px; | ||
max-height: 70vh; | ||
min-width: 400px; | ||
background-color: white; | ||
margin: auto; | ||
border-radius: 5px; | ||
padding: 1.5em; | ||
} | ||
|
||
.Modal-header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-bottom: 1px solid rgb(214, 214, 214); | ||
padding-bottom: 0.5em; | ||
} | ||
|
||
.Modal-header button { | ||
border: 0; | ||
cursor: pointer; | ||
} | ||
|
||
.Modal-header h3 { | ||
margin: 0; | ||
} | ||
|
||
.Modal-option-list { | ||
margin: 0; | ||
list-style-type: none; | ||
padding: 0; | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); | ||
gap: 10px; | ||
} | ||
|
||
.Modal-option-list li { | ||
padding: 1em; | ||
cursor: pointer; | ||
border: 1px solid rgb(214, 214, 214); | ||
border-radius: 5px; | ||
display: flex; | ||
} | ||
|
||
.Modal-option-list li div { | ||
margin: auto; | ||
} | ||
|
||
.Modal-option-list li:hover { | ||
border-color: black; | ||
} | ||
|
||
.Modal-option-list li img { | ||
display: block; | ||
margin: 0 auto; | ||
margin-bottom: 5px; | ||
max-width: 50px; | ||
} | ||
|
||
.Modal-dark-theme .Modal-content { | ||
background-color: #26292a; | ||
color: white; | ||
} | ||
|
||
.Modal-dark-theme .Modal-content .Modal-option-list li { | ||
border-color: black; | ||
} | ||
|
||
.Modal-dark-theme .Modal-content .Modal-option-list li:hover { | ||
border-color: white; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
.Modal:not(.Modal-light-theme) .Modal-content { | ||
background-color: #26292a !important; | ||
color: white; | ||
} | ||
|
||
.Modal:not(.Modal-light-theme) .Modal-content .Modal-option-list li { | ||
border-color: black; | ||
} | ||
|
||
.Modal:not(.Modal-light-theme) .Modal-content .Modal-option-list li:hover { | ||
border-color: white; | ||
} | ||
} | ||
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,98 @@ | ||
export default ` | ||
.Modal { | ||
position: fixed; | ||
top: 0; | ||
left: 0; | ||
width: 100%; | ||
height: 100vh; | ||
background-color: rgba(0, 0, 0, 0.25); | ||
display: flex; | ||
} | ||
.Modal .Modal-content { | ||
max-width: 700px; | ||
max-height: 70vh; | ||
min-width: 400px; | ||
background-color: white; | ||
margin: auto; | ||
border-radius: 5px; | ||
padding: 1.5em; | ||
} | ||
.Modal-header { | ||
display: flex; | ||
align-items: center; | ||
justify-content: space-between; | ||
border-bottom: 1px solid rgb(214, 214, 214); | ||
padding-bottom: 0.5em; | ||
} | ||
.Modal-header button { | ||
border: 0; | ||
cursor: pointer; | ||
} | ||
.Modal-header h3 { | ||
margin: 0; | ||
} | ||
.Modal-option-list { | ||
margin: 0; | ||
list-style-type: none; | ||
padding: 0; | ||
display: grid; | ||
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); | ||
gap: 10px; | ||
} | ||
.Modal-option-list li { | ||
padding: 1em; | ||
cursor: pointer; | ||
border: 1px solid rgb(214, 214, 214); | ||
border-radius: 5px; | ||
display: flex; | ||
} | ||
.Modal-option-list li div { | ||
margin: auto; | ||
} | ||
.Modal-option-list li:hover { | ||
border-color: black; | ||
} | ||
.Modal-option-list li img { | ||
display: block; | ||
margin: 0 auto; | ||
margin-bottom: 5px; | ||
max-width: 50px; | ||
} | ||
.Modal-dark-theme .Modal-content { | ||
background-color: #26292a; | ||
color: white; | ||
} | ||
.Modal-dark-theme .Modal-content .Modal-option-list li { | ||
border-color: black; | ||
} | ||
.Modal-dark-theme .Modal-content .Modal-option-list li:hover { | ||
border-color: white; | ||
} | ||
@media (prefers-color-scheme: dark) { | ||
.Modal:not(.Modal-light-theme) .Modal-content { | ||
background-color: #26292a !important; | ||
color: white; | ||
} | ||
.Modal:not(.Modal-light-theme) .Modal-content .Modal-option-list li { | ||
border-color: black; | ||
} | ||
.Modal:not(.Modal-light-theme) .Modal-content .Modal-option-list li:hover { | ||
border-color: white; | ||
} | ||
} | ||
`; |
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,5 +1,5 @@ | ||
import Modal from "./components/Modal/Modal"; | ||
|
||
export * from "./providers"; | ||
import * as providers from "./providers"; | ||
|
||
export default Modal; | ||
export default { Modal, providers }; |
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,31 +1,3 @@ | ||
import IWallet from "./interfaces/IWallet"; | ||
import CustomWallet from "./wallets/CustomWallet"; | ||
import LedgerWallet from "./wallets/LedgerWallet"; | ||
import NarWallet from "./wallets/NarWallet"; | ||
import NearWallet from "./wallets/NearWallet"; | ||
import SenderWallet from "./wallets/SenderWallet"; | ||
import * as wallets from "./wallets"; | ||
|
||
class Providers { | ||
private wallets = { | ||
nearwallet: new NearWallet(), | ||
senderwallet: new SenderWallet(), | ||
ledgerwallet: new LedgerWallet(), | ||
narwallet: new NarWallet(), | ||
}; | ||
|
||
public addCustomProvider(name: string, options: any) { | ||
const customWallet = new CustomWallet( | ||
options.name, | ||
options.description, | ||
options.icon, | ||
options.onConnectFunction | ||
); | ||
this.wallets[name] = customWallet; | ||
} | ||
|
||
public getProvider(name: string): IWallet { | ||
return this.wallets[name]; | ||
} | ||
} | ||
|
||
export default new Providers(); | ||
export { wallets }; |
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 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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import IWallet from "../interfaces/IWallet"; | ||
import CustomWallet from "./CustomWallet"; | ||
import LedgerWallet from "./LedgerWallet"; | ||
import NarWallet from "./NarWallet"; | ||
import NearWallet from "./NearWallet"; | ||
import SenderWallet from "./SenderWallet"; | ||
|
||
class Wallets { | ||
private wallets = { | ||
nearwallet: new NearWallet(), | ||
senderwallet: new SenderWallet(), | ||
ledgerwallet: new LedgerWallet(), | ||
narwallet: new NarWallet(), | ||
}; | ||
|
||
public addCustomWallet(name: string, options: any) { | ||
const customWallet = new CustomWallet( | ||
options.name, | ||
options.description, | ||
options.icon, | ||
options.onConnectFunction | ||
); | ||
this.wallets[name] = customWallet; | ||
} | ||
|
||
public getWallet(name: string): IWallet { | ||
return this.wallets[name]; | ||
} | ||
} | ||
|
||
const wallets = new Wallets(); | ||
|
||
export { wallets }; |