1+ import { createSignal , For } from "solid-js"
2+ import { WalletButton } from "../WalletButton"
3+
4+ export interface ConnectWalletProps {
5+ onBackClick ?: ( ) => void
6+ } ;
7+
8+ const WALLET_LIST = [ 'Metamask' , 'Ronin Wallet' , 'Phantom' , 'Rainbow' , 'Trust Wallet' , 'Coinbase Wallet' , 'Uniswap' , 'Metamask' , 'Ronin Wallet' , 'Phantom' , 'Rainbow' , 'Trust Wallet' , 'Coinbase Wallet' , 'Uniswap' , 'Metamask' , 'Ronin Wallet' , 'Phantom' , 'Rainbow' , 'Trust Wallet' , 'Coinbase Wallet' , 'Uniswap' ]
9+
10+
11+ const PAGES = {
12+ CONNECT_WALLET : 'Connect Wallet' ,
13+ SELECTED_WALLET : "Selected Wallet"
14+ }
15+
16+ const ConnectWallet = ( { onBackClick } : ConnectWalletProps ) => {
17+
18+ const [ currentPage , setCurrentPage ] = createSignal ( PAGES . CONNECT_WALLET ) ;
19+ const [ selectedWallet , setSelectedWallet ] = createSignal ( false ) ;
20+
21+ const handleBack = ( ) => {
22+ if ( ! selectedWallet ( ) && currentPage ( ) === PAGES . CONNECT_WALLET && onBackClick ) {
23+ onBackClick ( )
24+ }
25+
26+ if ( selectedWallet ) {
27+ setCurrentPage ( PAGES . CONNECT_WALLET )
28+ setSelectedWallet ( false )
29+ }
30+ }
31+
32+ return (
33+ < div class = "flex flex-col gap-y-4 flex-1 relative" >
34+ < div class = "flex items-center justify-between" >
35+ < figure class = "w-5 h-5 rounded-full bg-app-gray-200 cursor-pointer" onClick = { handleBack } > </ figure >
36+ < p class = "text-base font-medium text-app-gray-900" > { currentPage ( ) } </ p >
37+ < div class = "w-5 h-5" />
38+ </ div >
39+
40+ { ! selectedWallet ( ) ? < div class = "contents" >
41+ < input placeholder = "Search through wallets..." class = "w-full px-4 py-2.5 border border-app-gray-300 bg-app-gray-50 placeholder:text-app-gray-400 placeholder:text-sm placeholder:font-normal rounded-full" />
42+ < ul class = "flex flex-col gap-y-2 h-[calc(100dvh_-_240px)] overflow-y-auto" >
43+ < For each = { WALLET_LIST } >
44+ { ( wallet ) =>
45+ < WalletButton label = { wallet } onClick = { ( ) => { setSelectedWallet ( true ) ; setCurrentPage ( PAGES . SELECTED_WALLET ) } } />
46+ }
47+ </ For >
48+ </ ul >
49+ </ div > :
50+ < div class = "contents" >
51+ < div class = "bg-app-gray-200 rounded-lg h-[320px] w-[320px] mx-auto" > </ div >
52+ < p class = "text-center text-sm text-app-gray-500 font-normal" > Scan with a WalletConnect-supported wallet or click the QR code to copy to your clipboard.</ p >
53+ < div class = "flex items-center justify-between w-full mt-auto bg-app-gray-50 rounded-xl p-3" >
54+ < p class = "text-sm text-app-gray-900" > Don't have Trust Wallet?</ p >
55+ < button class = "appearance-none border border-app-gray-900 text-xs text-app-gray-900 rounded-full px-2 py-2" > Get Wallet</ button >
56+ </ div >
57+ </ div >
58+ }
59+
60+ { /* <div class="absolute bottom-0 left-0 bg-app-white rounded-lg p-6 w-full flex flex-col gap-y-2 shadow-sm border border-app-gray-100">
61+ <div class="flex items-center gap-x-2 w-full bg-app-gray-100 px-4 py-2 rounded-full">
62+ <figure class="w-5 h-5 rounded-full bg-app-gray-200 cursor-pointer"></figure>
63+ <p class="text-sm font-medium text-app-gray-900">Install Chrome</p>
64+ </div>
65+ <div class="flex items-center gap-x-2 w-full bg-app-gray-100 px-4 py-2 rounded-full">
66+ <figure class="w-5 h-5 rounded-full bg-app-gray-200 cursor-pointer"></figure>
67+ <p class="text-sm font-medium text-app-gray-900">Install Chrome</p>
68+ </div>
69+ <div class="flex items-center gap-x-2 w-full bg-app-gray-100 px-4 py-2 rounded-full">
70+ <figure class="w-5 h-5 rounded-full bg-app-gray-200 cursor-pointer"></figure>
71+ <p class="text-sm font-medium text-app-gray-900">Install Chrome</p>
72+ </div>
73+ </div> */ }
74+ </ div >
75+ )
76+ }
77+
78+ export default ConnectWallet
0 commit comments