@gluwa/connect-kit 0.2.0-next.1 → 0.2.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/assets/fonts/Inter-Medium.ttf +0 -0
  3. package/assets/fonts/Inter-Medium.woff2 +0 -0
  4. package/assets/fonts/Inter-Regular.ttf +0 -0
  5. package/assets/fonts/Inter-Regular.woff2 +0 -0
  6. package/assets/fonts/Inter-SemiBold.ttf +0 -0
  7. package/assets/fonts/Inter-SemiBold.woff2 +0 -0
  8. package/assets/graphic.png +0 -0
  9. package/assets/metamask.png +0 -0
  10. package/assets/penguinwallet.png +0 -0
  11. package/assets/wc-logo.svg +3 -0
  12. package/assets/wc-search.png +0 -0
  13. package/dist/chunk-VE5LB7BN.js +405 -0
  14. package/dist/credit-connect.js +2 -409
  15. package/dist/index.css +1903 -389
  16. package/dist/index.d.ts +21 -10
  17. package/dist/index.js +1507 -922
  18. package/dist/package.json +7 -6
  19. package/package.json +8 -8
  20. package/src/ConnectKitProvider.tsx +97 -65
  21. package/src/api/asset.ts +10 -0
  22. package/src/assets.d.ts +5 -0
  23. package/src/components/actionItem/index.tsx +50 -0
  24. package/src/components/actionItem/style.scss +47 -0
  25. package/src/components/copyLink/index.tsx +16 -0
  26. package/src/components/copyLink/style.scss +16 -0
  27. package/src/components/qrArea/index.tsx +72 -0
  28. package/src/components/qrArea/style.scss +122 -0
  29. package/src/components/searchBar/asset/Search.tsx +20 -0
  30. package/src/components/searchBar/asset/XMarkCircle.tsx +24 -0
  31. package/src/components/searchBar/index.tsx +44 -0
  32. package/src/components/searchBar/style.scss +58 -0
  33. package/src/components/toast/index.tsx +41 -0
  34. package/src/components/toast/style.scss +108 -0
  35. package/src/components/toggle/index.tsx +27 -0
  36. package/src/components/toggle/style.scss +53 -0
  37. package/src/components/walletGrid/index.tsx +64 -0
  38. package/src/components/walletGrid/style.scss +108 -0
  39. package/src/components/walletItem/index.tsx +49 -0
  40. package/src/components/walletItem/style.scss +70 -0
  41. package/src/connector-meta.ts +16 -11
  42. package/src/core/config.ts +20 -1
  43. package/src/creditConnectConnector.ts +23 -25
  44. package/src/events/account.ts +30 -3
  45. package/src/hooks/useConnectBanner.ts +79 -0
  46. package/src/hooks/useConnectTimeout.ts +92 -0
  47. package/src/hooks/useMetaMaskExtension.ts +29 -0
  48. package/src/hooks/useWCState.ts +21 -5
  49. package/src/hooks/useWagmiConnect.ts +35 -9
  50. package/src/index.ts +5 -2
  51. package/src/layout/allWallets/index.tsx +52 -0
  52. package/src/layout/allWallets/style.scss +57 -0
  53. package/src/layout/connectDialog/asset/backIcon.tsx +24 -0
  54. package/src/layout/connectDialog/asset/checkIcon.tsx +28 -0
  55. package/src/layout/connectDialog/asset/closeIcon.tsx +21 -0
  56. package/src/layout/connectDialog/asset/copyIcon.tsx +28 -0
  57. package/src/layout/connectDialog/asset/linkIcon.tsx +24 -0
  58. package/src/layout/connectDialog/asset/spinner.tsx +21 -0
  59. package/src/layout/connectDialog/asset/warningIcon.tsx +21 -0
  60. package/src/layout/connectDialog/idle/assets/banner-placeholder.png +0 -0
  61. package/src/layout/connectDialog/idle/index.tsx +55 -0
  62. package/src/layout/connectDialog/idle/style.scss +52 -0
  63. package/src/layout/connectDialog/index.tsx +432 -0
  64. package/src/layout/connectDialog/loading/index.tsx +13 -0
  65. package/src/layout/connectDialog/loading/style.scss +19 -0
  66. package/src/layout/connectDialog/metaMask/index.tsx +61 -0
  67. package/src/layout/connectDialog/metaMask/style.scss +65 -0
  68. package/src/layout/connectDialog/qr/index.tsx +33 -0
  69. package/src/layout/connectDialog/style.scss +48 -0
  70. package/src/layout/connectDialog/timeout/index.tsx +31 -0
  71. package/src/layout/connectDialog/timeout/style.scss +64 -0
  72. package/src/layout/connectDialog/walletConnect/index.tsx +45 -0
  73. package/src/layout/connectDialog/walletConnect/style.scss +48 -0
  74. package/src/layout/connectDialog/walletQR/index.tsx +37 -0
  75. package/src/layout/detailPanel/index.tsx +175 -0
  76. package/src/layout/detailPanel/style.scss +70 -0
  77. package/src/layout/selectorPanel/index.tsx +100 -0
  78. package/src/layout/selectorPanel/style.scss +113 -0
  79. package/src/style/color.scss +417 -0
  80. package/src/style/font.scss +28 -0
  81. package/src/style/index.scss +5 -0
  82. package/src/style/mixin.scss +217 -0
  83. package/src/style/reset.scss +110 -0
  84. package/src/style/variables.scss +13 -0
  85. package/src/types.ts +32 -8
  86. package/src/utils/platform.ts +5 -3
  87. package/src/wallet-display-override.ts +15 -0
  88. package/tsconfig.json +5 -1
  89. package/tsup.config.ts +32 -2
  90. package/assets/creditwallet.png +0 -0
  91. package/dist/chunk-DDA6FP6U.js +0 -7
  92. package/src/ConnectModal.scss +0 -665
  93. package/src/ConnectModal.tsx +0 -573
  94. package/src/components/QRFrame.tsx +0 -43
  95. package/src/views/CreditWalletView.tsx +0 -58
  96. package/src/views/IdleView.tsx +0 -10
  97. package/src/views/MetaMaskView.tsx +0 -66
  98. package/src/views/SwitchChainView.tsx +0 -72
  99. package/src/views/WalletConnectView.tsx +0 -206
@@ -0,0 +1,31 @@
1
+ import { type FC } from 'react';
2
+ import './style.scss';
3
+
4
+ interface TimeoutProps {
5
+ onRetry?: () => void;
6
+ }
7
+
8
+ export const Timeout: FC<TimeoutProps> = ({ onRetry }) => {
9
+ return (
10
+ <div className="ck-timeout">
11
+ <div className="ck-timeout-text">
12
+ <h3 className="ck-timeout-title">Connection Failed</h3>
13
+ <p className="ck-timeout-desc">
14
+ The connection took too long to respond.
15
+ <br />
16
+ Please check your network and try again.
17
+ </p>
18
+ </div>
19
+ <button type="button" className="ck-timeout-retry-btn" onClick={onRetry}>
20
+ Try Again
21
+ </button>
22
+ {/* TODO [D]: add help link after url is confirmed */}
23
+ {/* <p className="ck-timeout-help">
24
+ Need more help?
25
+ <a href="#" className="ck-timeout-help-link">
26
+ Click here
27
+ </a>
28
+ </p> */}
29
+ </div>
30
+ );
31
+ };
@@ -0,0 +1,64 @@
1
+ @use '../../../style/mixin.scss' as *;
2
+
3
+ .ck-timeout {
4
+ display: flex;
5
+ flex-direction: column;
6
+ align-items: center;
7
+ justify-content: center;
8
+ flex: 1;
9
+ gap: 24px;
10
+ text-align: center;
11
+ }
12
+
13
+ .ck-timeout-text {
14
+ display: flex;
15
+ flex-direction: column;
16
+ gap: 6px;
17
+ }
18
+
19
+ .ck-timeout-title {
20
+ @include textToken('title3-bold');
21
+ color: var(--scale-gray-900);
22
+ }
23
+
24
+ .ck-timeout-desc {
25
+ @include textToken('body4-l1-regular');
26
+ color: var(--scale-gray-600);
27
+ }
28
+
29
+ .ck-root .ck-timeout-retry-btn {
30
+ display: inline-flex;
31
+ align-items: center;
32
+ justify-content: center;
33
+ padding: 12px 28px;
34
+ border: 1px solid var(--semantic-divider-divider-4);
35
+ border-radius: 500px;
36
+ @include textToken('label4-bold');
37
+ color: var(--scale-gray-900);
38
+ cursor: pointer;
39
+ transition: background 0.15s ease;
40
+
41
+ &:hover {
42
+ background: var(--scale-gray-100);
43
+ }
44
+ }
45
+
46
+ .ck-timeout-help {
47
+ @include textToken('body4-l1-regular');
48
+ color: var(--scale-gray-500);
49
+ }
50
+
51
+ .ck-root .ck-timeout-help-link {
52
+ color: var(--semantic-brand-trugi-primary);
53
+ text-decoration: none;
54
+
55
+ &:hover {
56
+ text-decoration: underline;
57
+ }
58
+ }
59
+
60
+ @include tablet {
61
+ .ck-timeout {
62
+ min-height: 491px;
63
+ }
64
+ }
@@ -0,0 +1,45 @@
1
+ import { type FC } from 'react';
2
+ import './style.scss';
3
+ import { QrArea } from '../../../components/qrArea';
4
+ import { ActionItem } from '../../../components/actionItem';
5
+
6
+ interface WalletConnectProps {
7
+ uri?: string | null;
8
+ logoUrl?: string;
9
+ walletCount?: number;
10
+ onShowAllWallets?: () => void;
11
+ onCopy?: () => void;
12
+ }
13
+
14
+ export const WalletConnect: FC<WalletConnectProps> = ({
15
+ uri,
16
+ logoUrl,
17
+ walletCount,
18
+ onShowAllWallets,
19
+ onCopy,
20
+ }) => {
21
+ return (
22
+ <>
23
+ <QrArea
24
+ uri={uri}
25
+ status={!uri ? 'loading' : 'ready'}
26
+ logoUrl={logoUrl}
27
+ hasBg
28
+ label="Scan this QR Code with your phone"
29
+ onCopy={onCopy}
30
+ />
31
+ <ActionItem
32
+ as="button"
33
+ type="button"
34
+ className="ck-walletconnect-all-btn"
35
+ onClick={onShowAllWallets}
36
+ >
37
+ <span className="ck-walletconnect-all-icon" aria-hidden="true" />
38
+ <span className="ck-walletconnect-all-label">All Wallets</span>
39
+ {typeof walletCount === 'number' && walletCount > 0 && (
40
+ <span className="ck-walletconnect-all-badge">{walletCount}+</span>
41
+ )}
42
+ </ActionItem>
43
+ </>
44
+ );
45
+ };
@@ -0,0 +1,48 @@
1
+ @use '../../../style/mixin.scss' as *;
2
+
3
+
4
+ .ck-root .ck-walletconnect-copy-btn {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ gap: 6px;
8
+ @include textToken('body3-l1-regular');
9
+ color: var(--scale-gray-500);
10
+ cursor: pointer;
11
+ }
12
+
13
+ .ck-walletconnect-copy-icon {
14
+ display: block;
15
+ width: 20px;
16
+ height: 20px;
17
+ }
18
+
19
+ // ── All Wallets button ─────────────────────────────────────────────────────────
20
+
21
+ .ck-walletconnect-all-icon {
22
+ width: 44px;
23
+ height: 44px;
24
+ border-radius: 6px;
25
+ background:
26
+ radial-gradient(circle at 16.5px 16.5px, var(--scale-purple-500) 3px, transparent 4px),
27
+ radial-gradient(circle at 27.5px 16.5px, var(--scale-purple-500) 3px, transparent 4px),
28
+ radial-gradient(circle at 16.5px 27.5px, var(--scale-purple-500) 3px, transparent 4px),
29
+ radial-gradient(circle at 27.5px 27.5px, var(--scale-purple-500) 3px, transparent 4px),
30
+ var(--scale-gray-300);
31
+ flex-shrink: 0;
32
+ }
33
+
34
+ .ck-walletconnect-all-label {
35
+ flex: 1;
36
+ @include textToken('subtitle2-bold');
37
+ color: var(--scale-gray-900);
38
+ text-align: left;
39
+ }
40
+
41
+ .ck-walletconnect-all-badge {
42
+ @include textToken('caption1-bold');
43
+ color: var(--scale-gray-900);
44
+ background: var(--scale-gray-300);
45
+ padding: 4px 8px;
46
+ border-radius: 4px;
47
+ flex-shrink: 0;
48
+ }
@@ -0,0 +1,37 @@
1
+ import { type FC } from 'react';
2
+ import { type WCWallet } from '../../../types';
3
+ import { QrArea } from '../../../components/qrArea';
4
+ import { ActionItem } from '../../../components/actionItem';
5
+
6
+ interface WalletQRProps {
7
+ wallet: WCWallet;
8
+ uri?: string | null;
9
+ onCopy?: () => void;
10
+ }
11
+
12
+ export const WalletQR: FC<WalletQRProps> = ({ wallet, uri = null, onCopy }) => {
13
+ const downloadUrl = wallet.appIos || wallet.appAndroid || wallet.homepage;
14
+
15
+ return (
16
+ <>
17
+ <QrArea
18
+ uri={uri}
19
+ status={!uri ? 'loading' : 'ready'}
20
+ logoUrl={wallet.imageUrl || undefined}
21
+ hasBg
22
+ label={`Scan with ${wallet.name}`}
23
+ onCopy={onCopy}
24
+ />
25
+ {downloadUrl && (
26
+ <ActionItem
27
+ as="a"
28
+ href={downloadUrl}
29
+ target="_blank"
30
+ rel="noopener noreferrer"
31
+ label={`Don't have ${wallet.name}?`}
32
+ action="Download"
33
+ />
34
+ )}
35
+ </>
36
+ );
37
+ };
@@ -0,0 +1,175 @@
1
+ import { type FC } from 'react';
2
+ import { CloseIcon } from '../connectDialog/asset/closeIcon';
3
+ import { BackIcon } from '../connectDialog/asset/backIcon';
4
+ import './style.scss';
5
+ import { type ConnectBanner, type ConnectorId, type WCWallet } from '../../types';
6
+ import { CONNECTOR_META } from '../../connector-meta';
7
+ import { Idle } from '../connectDialog/idle';
8
+ import { Loading } from '../connectDialog/loading';
9
+ import { QR } from '../connectDialog/qr';
10
+ import { Timeout } from '../connectDialog/timeout';
11
+ import { MetaMask } from '../connectDialog/metaMask';
12
+ import { WalletConnect } from '../connectDialog/walletConnect';
13
+ import { AllWallets } from '../allWallets';
14
+ import { WalletQR } from '../connectDialog/walletQR';
15
+
16
+ export type DetailContent =
17
+ | 'idle'
18
+ | 'loading'
19
+ | 'qr'
20
+ | 'timeout'
21
+ | 'metamask-ext'
22
+ | 'metamask-qr'
23
+ | 'walletconnect'
24
+ | 'all-wallets'
25
+ | 'wallet-qr';
26
+
27
+ interface DetailPanelProps {
28
+ connectBanner?: ConnectBanner | null;
29
+ connectBannerLoading?: boolean;
30
+ selectedConnector: ConnectorId | null;
31
+ selectedWallet?: WCWallet | null;
32
+ content?: DetailContent;
33
+ /** wagmi connect 가 emit 한 QR code URI (display_uri 이벤트). null = 아직 도착 안 함. */
34
+ qrUri?: string | null;
35
+ /** WalletConnect Explorer API 의 walletList (AllWallets 그리드). */
36
+ wallets?: WCWallet[];
37
+ walletListLoading?: boolean;
38
+ /** Selector 의 'WC' 카운트 표시용 — 보통 walletList.length. */
39
+ walletCount?: number;
40
+ onBack: () => void;
41
+ onClose: () => void;
42
+ onShowAllWallets?: () => void;
43
+ onSelectWallet?: (wallet: WCWallet) => void;
44
+ onCopyLink?: () => void;
45
+ /** timeout 화면의 "Try Again" 버튼 핸들러. */
46
+ onRetry?: () => void;
47
+ }
48
+
49
+ const getTitle = (content: DetailContent, connector: ConnectorId | null): string => {
50
+ switch (content) {
51
+ case 'idle':
52
+ return '';
53
+ case 'loading':
54
+ return connector ? CONNECTOR_META[connector].detailTitle : '';
55
+ case 'qr':
56
+ return connector ? CONNECTOR_META[connector].detailTitle : '';
57
+ case 'timeout':
58
+ return connector ? CONNECTOR_META[connector].detailTitle : '';
59
+ case 'metamask-ext':
60
+ return 'MetaMask';
61
+ case 'metamask-qr':
62
+ return 'Scan with MetaMask';
63
+ case 'walletconnect':
64
+ return 'Scan with WalletConnect';
65
+ case 'all-wallets':
66
+ return 'All Wallets';
67
+ case 'wallet-qr':
68
+ return '';
69
+ }
70
+ };
71
+
72
+ export const DetailPanel: FC<DetailPanelProps> = ({
73
+ connectBanner = null,
74
+ connectBannerLoading = false,
75
+ selectedConnector,
76
+ selectedWallet = null,
77
+ content = 'idle',
78
+ qrUri = null,
79
+ wallets = [],
80
+ walletListLoading = false,
81
+ walletCount,
82
+ onBack,
83
+ onClose,
84
+ onShowAllWallets,
85
+ onSelectWallet,
86
+ onCopyLink,
87
+ onRetry,
88
+ }) => {
89
+ // CONNECTOR_META 에서 활성 connector 의 logo / downloadUrl 가져옴.
90
+ const connectorMeta = selectedConnector ? CONNECTOR_META[selectedConnector] : null;
91
+ const connectorLogoUrl = connectorMeta?.logoUrl;
92
+ const connectorDownloadUrl = connectorMeta?.downloadUrl;
93
+ const title =
94
+ selectedWallet && content === 'wallet-qr'
95
+ ? `Scan with ${selectedWallet.name}`
96
+ : getTitle(content, selectedConnector);
97
+ const showBack = content !== 'idle';
98
+ const closeColor =
99
+ content === 'idle' && !connectBannerLoading
100
+ ? (connectBanner?.closeColor ?? '#FFFFFF')
101
+ : undefined;
102
+
103
+ return (
104
+ <section className="ck-detail">
105
+ <header className="ck-detail-header">
106
+ {showBack && (
107
+ <button type="button" className="ck-btn-back" onClick={onBack} aria-label="Back">
108
+ <BackIcon />
109
+ </button>
110
+ )}
111
+ {title ? (
112
+ <h2 className="ck-detail-title">{title}</h2>
113
+ ) : (
114
+ <span className="ck-detail-header-spacer" aria-hidden="true" />
115
+ )}
116
+ <button
117
+ type="button"
118
+ className="ck-btn-close"
119
+ onClick={onClose}
120
+ aria-label="Close"
121
+ style={{ color: closeColor }}
122
+ >
123
+ <CloseIcon />
124
+ </button>
125
+ </header>
126
+ <div className="ck-detail-body">
127
+ {content === 'idle' && !connectBannerLoading && (
128
+ <Idle
129
+ title={connectBanner?.title}
130
+ description={connectBanner?.subtitle}
131
+ linkText={connectBanner?.linkText}
132
+ linkUrl={connectBanner?.linkUrl}
133
+ imageUrl={connectBanner?.imageUrl}
134
+ titleColor={connectBanner?.titleColor}
135
+ descriptionColor={connectBanner?.subtitleColor}
136
+ linkTextColor={connectBanner?.linkTextColor}
137
+ />
138
+ )}
139
+ {content === 'loading' && <Loading />}
140
+ {content === 'qr' && (
141
+ <QR uri={qrUri} logoUrl={connectorLogoUrl} downloadUrl={connectorDownloadUrl} />
142
+ )}
143
+ {content === 'timeout' && <Timeout onRetry={onRetry} />}
144
+ {(content === 'metamask-ext' || content === 'metamask-qr') && (
145
+ <MetaMask
146
+ variant={content === 'metamask-ext' ? 'extension' : 'qr'}
147
+ logoUrl={connectorLogoUrl}
148
+ uri={qrUri}
149
+ downloadUrl={connectorDownloadUrl}
150
+ onCopy={onCopyLink}
151
+ />
152
+ )}
153
+ {content === 'walletconnect' && (
154
+ <WalletConnect
155
+ uri={qrUri}
156
+ logoUrl={connectorLogoUrl}
157
+ walletCount={walletCount}
158
+ onShowAllWallets={onShowAllWallets}
159
+ onCopy={onCopyLink}
160
+ />
161
+ )}
162
+ {content === 'all-wallets' && (
163
+ <AllWallets
164
+ wallets={wallets}
165
+ isLoading={walletListLoading}
166
+ onSelectWallet={onSelectWallet ?? (() => undefined)}
167
+ />
168
+ )}
169
+ {content === 'wallet-qr' && selectedWallet && (
170
+ <WalletQR wallet={selectedWallet} uri={qrUri} onCopy={onCopyLink} />
171
+ )}
172
+ </div>
173
+ </section>
174
+ );
175
+ };
@@ -0,0 +1,70 @@
1
+ @use '../../style/mixin.scss' as *;
2
+
3
+ .ck-detail {
4
+ display: flex;
5
+ flex-direction: column;
6
+ min-width: 0;
7
+ background: var(--semantic-paper-dialog);
8
+ min-height: 0;
9
+ position: relative;
10
+ }
11
+
12
+ // ── Header ────────────────────────────────────────────────────────────────────
13
+ .ck-detail-header {
14
+ display: flex;
15
+ align-items: center;
16
+ position: relative;
17
+ z-index: 1;
18
+ gap: 10px;
19
+ height: 60px;
20
+ padding: 0 20px;
21
+ flex-shrink: 0;
22
+ }
23
+
24
+ .ck-btn-back {
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ width: 14px;
29
+ height: 20px;
30
+ flex-shrink: 0;
31
+ color: var(--scale-gray-900);
32
+ }
33
+
34
+ .ck-detail-title {
35
+ @include textToken('subtitle1-bold');
36
+ flex: 1;
37
+ color: var(--scale-gray-900);
38
+ overflow: hidden;
39
+ text-overflow: ellipsis;
40
+ white-space: nowrap;
41
+ }
42
+
43
+ .ck-detail-header-spacer {
44
+ flex: 1;
45
+ }
46
+
47
+ .ck-btn-close {
48
+ display: flex;
49
+ align-items: center;
50
+ justify-content: center;
51
+ width: 20px;
52
+ height: 20px;
53
+ flex-shrink: 0;
54
+ color: var(--scale-gray-900);
55
+ }
56
+
57
+ // ── Body ──────────────────────────────────────────────────────────────────────
58
+ .ck-detail-body {
59
+ display: flex;
60
+ flex-direction: column;
61
+ flex: 1;
62
+ min-height: 0;
63
+ overflow-y: auto;
64
+ padding: 20px;
65
+ @include themedScrollbar;
66
+
67
+ &:has(.ck-all-wallets) {
68
+ padding-bottom: 0;
69
+ }
70
+ }
@@ -0,0 +1,100 @@
1
+ import { type FC } from 'react';
2
+ import { CloseIcon } from '../connectDialog/asset/closeIcon';
3
+ import './style.scss';
4
+ import { type ConnectorId } from '../../types';
5
+ import { CONNECTOR_META } from '../../connector-meta';
6
+ import { WalletItem } from '../../components/walletItem';
7
+ import { LinkIcon } from '../connectDialog/asset/linkIcon';
8
+
9
+ const MAIN_CONNECTORS = new Set<ConnectorId>(['CREDIT_CONNECT']);
10
+
11
+ interface SelectorPanelProps {
12
+ connectors: ConnectorId[];
13
+ selectedConnector: ConnectorId | null;
14
+ recentConnector?: ConnectorId | null;
15
+ onSelect: (id: ConnectorId) => void;
16
+ onClose: () => void;
17
+ }
18
+
19
+ export const SelectorPanel: FC<SelectorPanelProps> = ({
20
+ connectors,
21
+ selectedConnector,
22
+ recentConnector = null,
23
+ onSelect,
24
+ onClose,
25
+ }) => {
26
+ const mainConnectors = connectors.filter((id) => MAIN_CONNECTORS.has(id));
27
+ const subConnectors = connectors.filter((id) => !MAIN_CONNECTORS.has(id));
28
+ const hasDivider = mainConnectors.length > 0 && subConnectors.length > 0;
29
+
30
+ return (
31
+ <section className="ck-selector">
32
+ <header className="ck-selector-header">
33
+ <h2 className="ck-selector-title">Connect Wallet</h2>
34
+ {/* Close button — visible on mobile only via CSS */}
35
+ <button
36
+ type="button"
37
+ className="ck-btn-close ck-selector-close"
38
+ onClick={onClose}
39
+ aria-label="Close"
40
+ >
41
+ <CloseIcon />
42
+ </button>
43
+ </header>
44
+
45
+ <div className="ck-selector-body">
46
+ <div className="ck-selector-service">
47
+ {mainConnectors.length > 0 && (
48
+ <ul className="ck-selector-main" role="list">
49
+ {mainConnectors.map((id) => (
50
+ <li key={id}>
51
+ <WalletItem
52
+ id={id}
53
+ label={CONNECTOR_META[id].label}
54
+ logoUrl={CONNECTOR_META[id].logoUrl}
55
+ isSelected={selectedConnector === id}
56
+ isRecent={recentConnector === id}
57
+ onSelect={onSelect}
58
+ />
59
+ </li>
60
+ ))}
61
+ </ul>
62
+ )}
63
+
64
+ {hasDivider && (
65
+ <div className="ck-selector-divider" aria-hidden="true">
66
+ <span className="ck-selector-divider-label">OR</span>
67
+ </div>
68
+ )}
69
+
70
+ {subConnectors.length > 0 && (
71
+ <ul className="ck-selector-sub" role="list">
72
+ {subConnectors.map((id) => (
73
+ <li key={id}>
74
+ <WalletItem
75
+ id={id}
76
+ label={CONNECTOR_META[id].label}
77
+ logoUrl={CONNECTOR_META[id].logoUrl}
78
+ isSelected={selectedConnector === id}
79
+ isRecent={recentConnector === id}
80
+ onSelect={onSelect}
81
+ />
82
+ </li>
83
+ ))}
84
+ </ul>
85
+ )}
86
+ </div>
87
+
88
+ <a
89
+ className="ck-no-wallet-btn"
90
+ href="https://creditcoin.org/Credit-Wallet"
91
+ target="_blank"
92
+ rel="noopener noreferrer"
93
+ >
94
+ <span className="ck-no-wallet-btn-label">I don't have a wallet</span>
95
+ <LinkIcon className="ck-no-wallet-btn-icon" />
96
+ </a>
97
+ </div>
98
+ </section>
99
+ );
100
+ };
@@ -0,0 +1,113 @@
1
+ @use '../../style/mixin.scss' as *;
2
+
3
+ .ck-selector {
4
+ display: flex;
5
+ flex-direction: column;
6
+ min-height: 0;
7
+ overflow: hidden;
8
+ background: var(--semantic-paper-sheet);
9
+ border-right: 1px solid var(--semantic-divider-divider-2);
10
+
11
+ @include tablet {
12
+ border-right: none;
13
+ }
14
+ }
15
+
16
+ .ck-selector-header {
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: space-between;
20
+ height: 60px;
21
+ padding: 0 20px;
22
+ flex-shrink: 0;
23
+ }
24
+
25
+ .ck-selector-title {
26
+ @include textToken('subtitle1-bold');
27
+ color: var(--scale-gray-900);
28
+ }
29
+
30
+ .ck-selector-close.ck-btn-close {
31
+ display: none;
32
+
33
+ @include tablet {
34
+ display: flex !important;
35
+ align-items: center;
36
+ justify-content: center;
37
+ width: 20px;
38
+ height: 20px;
39
+ }
40
+ }
41
+
42
+ .ck-selector-body {
43
+ display: flex;
44
+ flex-direction: column;
45
+ justify-content: space-between;
46
+ flex: 1;
47
+ min-height: 0;
48
+ overflow-y: auto;
49
+ padding: 20px;
50
+ gap: 0;
51
+ @include themedScrollbar;
52
+ }
53
+
54
+ .ck-selector-service {
55
+ display: flex;
56
+ flex-direction: column;
57
+ gap: 32px;
58
+ }
59
+
60
+ .ck-selector-main {
61
+ display: flex;
62
+ flex-direction: column;
63
+ gap: 0;
64
+ }
65
+
66
+ .ck-selector-sub {
67
+ display: flex;
68
+ flex-direction: column;
69
+ gap: 10px;
70
+ }
71
+
72
+ .ck-selector-divider {
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 16px;
76
+
77
+ &::before,
78
+ &::after {
79
+ content: '';
80
+ flex: 1;
81
+ height: 1px;
82
+ background: var(--semantic-divider-divider-1);
83
+ }
84
+ }
85
+
86
+ .ck-selector-divider-label {
87
+ @include textToken('label4-regular');
88
+ color: var(--scale-gray-400);
89
+ }
90
+
91
+ .ck-root .ck-no-wallet-btn {
92
+ display: flex;
93
+ align-items: center;
94
+ justify-content: center;
95
+ gap: 4px;
96
+ width: 100%;
97
+ padding: 12px 20px;
98
+ color: var(--scale-gray-600);
99
+ cursor: pointer;
100
+
101
+ @include tablet {
102
+ margin-top: 20px;
103
+ }
104
+ }
105
+
106
+ .ck-no-wallet-btn-label {
107
+ @include textToken('label4-regular');
108
+ }
109
+
110
+ .ck-no-wallet-btn-icon {
111
+ flex-shrink: 0;
112
+ color: var(--scale-gray-600);
113
+ }