@coinbase/create-cdp-app 0.0.6 → 0.0.8
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.
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/template-react-components/index.html +1 -1
- package/template-react-components/public/eth.svg +25 -0
- package/template-react-components/src/App.tsx +9 -8
- package/template-react-components/src/Header.tsx +62 -0
- package/template-react-components/src/Icons.tsx +66 -0
- package/template-react-components/src/Loading.tsx +15 -0
- package/template-react-components/src/SignInScreen.tsx +17 -0
- package/template-react-components/src/SignedInScreen.tsx +64 -0
- package/template-react-components/src/Transaction.tsx +87 -43
- package/template-react-components/src/UserBalance.tsx +43 -0
- package/template-react-components/src/index.css +264 -67
- package/template-react-components/src/main.tsx +2 -1
- package/template-react-components/src/theme.ts +32 -0
- package/template-react-components/pnpm-lock.yaml +0 -3116
|
@@ -1,119 +1,316 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
--cdp-example-page-bg-color: #eaeaea;
|
|
3
|
+
--cdp-example-bg-overlay-color: rgba(0, 0, 0, 0.25);
|
|
4
|
+
--cdp-example-bg-skeleton-color: rgba(0, 0, 0, 0.1);
|
|
5
|
+
--cdp-example-text-color: #111111;
|
|
6
|
+
--cdp-example-text-secondary-color: #757575;
|
|
7
|
+
--cdp-example-accent-color: #0052ff;
|
|
8
|
+
--cdp-example-accent-hover-color: #0044d6;
|
|
9
|
+
--cdp-example-accent-foreground-color: #ffffff;
|
|
10
|
+
--cdp-example-bg-low-contrast-color: #eeeeee;
|
|
11
|
+
--cdp-example-card-bg-color: #ffffff;
|
|
12
|
+
--cdp-example-card-border-color: #dcdcdc;
|
|
13
|
+
--cdp-example-card-max-width: 30rem;
|
|
14
|
+
--cdp-example-base-font-size: 16px;
|
|
15
|
+
--cdp-example-font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
5
16
|
|
|
17
|
+
background-color: var(--cdp-example-page-bg-color);
|
|
18
|
+
color: var(--cdp-example-card-border-color);
|
|
6
19
|
color-scheme: light dark;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
20
|
+
font-family: var(--cdp-example-font-family);
|
|
21
|
+
font-size: var(--cdp-example-base-font-size);
|
|
10
22
|
font-synthesis: none;
|
|
23
|
+
font-weight: 400;
|
|
24
|
+
line-height: 1.5;
|
|
11
25
|
text-rendering: optimizeLegibility;
|
|
12
26
|
-webkit-font-smoothing: antialiased;
|
|
13
27
|
-moz-osx-font-smoothing: grayscale;
|
|
14
28
|
}
|
|
15
29
|
|
|
30
|
+
@media (prefers-color-scheme: dark) {
|
|
31
|
+
:root {
|
|
32
|
+
--cdp-example-page-bg-color: #0a0b0d;
|
|
33
|
+
--cdp-example-bg-overlay-color: rgba(0, 0, 0, 0.25);
|
|
34
|
+
--cdp-example-bg-skeleton-color: rgba(255, 255, 255, 0.1);
|
|
35
|
+
--cdp-example-text-color: #fafafa;
|
|
36
|
+
--cdp-example-text-secondary-color: #8a919e;
|
|
37
|
+
--cdp-example-accent-color: #578bfa;
|
|
38
|
+
--cdp-example-accent-hover-color: #3e79f9;
|
|
39
|
+
--cdp-example-accent-foreground-color: #0a0b0d;
|
|
40
|
+
--cdp-example-bg-low-contrast-color: #32353d;
|
|
41
|
+
--cdp-example-card-bg-color: #141519;
|
|
42
|
+
--cdp-example-card-border-color: #24262a;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
::selection {
|
|
47
|
+
background-color: color(from var(--cdp-example-accent-color) srgb r g b / 0.3);
|
|
48
|
+
}
|
|
49
|
+
|
|
16
50
|
html,
|
|
17
51
|
html * {
|
|
18
52
|
box-sizing: border-box;
|
|
19
53
|
}
|
|
20
54
|
|
|
21
|
-
|
|
55
|
+
body {
|
|
22
56
|
margin: 0;
|
|
23
|
-
|
|
24
|
-
width:
|
|
25
|
-
height: 100vh;
|
|
57
|
+
min-height: 100vh;
|
|
58
|
+
min-width: 320px;
|
|
26
59
|
}
|
|
27
60
|
|
|
28
|
-
|
|
61
|
+
body,
|
|
62
|
+
#root,
|
|
63
|
+
#root > div,
|
|
64
|
+
.flex-col-container {
|
|
29
65
|
display: flex;
|
|
30
66
|
flex-direction: column;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
place-items: center;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.flex-row-container {
|
|
31
72
|
align-items: center;
|
|
73
|
+
display: flex;
|
|
74
|
+
flex-direction: row;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.flex-grow {
|
|
78
|
+
flex-grow: 1;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.sr-only {
|
|
82
|
+
border-width: 0;
|
|
83
|
+
clip: rect(0, 0, 0, 0);
|
|
84
|
+
height: 1px;
|
|
85
|
+
margin: -1px;
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
padding: 0;
|
|
88
|
+
position: absolute;
|
|
89
|
+
white-space: nowrap;
|
|
90
|
+
width: 1px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
#root {
|
|
94
|
+
flex-grow: 1;
|
|
95
|
+
margin: 0;
|
|
96
|
+
padding: 0rem;
|
|
32
97
|
width: 100%;
|
|
33
|
-
height: 100%;
|
|
34
|
-
color: var(--cdp-web-colors-text);
|
|
35
|
-
margin: 0 auto;
|
|
36
98
|
}
|
|
37
99
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
--cdp-web-button-ring-inset-color: transparent;
|
|
42
|
-
--cdp-web-button-ring-inset-width: 2px;
|
|
100
|
+
#root > div {
|
|
101
|
+
flex-grow: 1;
|
|
102
|
+
}
|
|
43
103
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
104
|
+
p {
|
|
105
|
+
margin: 0;
|
|
106
|
+
}
|
|
47
107
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
justify-content: center;
|
|
51
|
-
gap: 0.5em;
|
|
52
|
-
padding: 1em;
|
|
53
|
-
border-radius: 9999em;
|
|
54
|
-
border: 0;
|
|
55
|
-
background-color: var(--cdp-web-colors-primary);
|
|
56
|
-
color: var(--cdp-web-colors-primaryText);
|
|
57
|
-
font-size: 1em;
|
|
58
|
-
font-weight: 500;
|
|
59
|
-
line-height: 1.5;
|
|
60
|
-
text-decoration: none;
|
|
61
|
-
cursor: pointer;
|
|
62
|
-
transition: all 0.15s ease-in-out;
|
|
63
|
-
user-select: none;
|
|
108
|
+
a {
|
|
109
|
+
color: var(--cdp-example-accent-color);
|
|
64
110
|
}
|
|
65
111
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
color: var(--cdp-web-colors-primaryHoverText);
|
|
112
|
+
a:hover {
|
|
113
|
+
color: var(--cdp-example-accent-hover-color);
|
|
69
114
|
}
|
|
70
115
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
116
|
+
hr {
|
|
117
|
+
border: 0 solid var(--cdp-example-card-border-color);
|
|
118
|
+
border-bottom-width: 1px;
|
|
119
|
+
margin: 1rem 0;
|
|
75
120
|
}
|
|
76
121
|
|
|
77
|
-
.
|
|
122
|
+
.app {
|
|
123
|
+
height: 100%;
|
|
124
|
+
color: var(--cdp-web-colors-text);
|
|
125
|
+
margin: 0 auto;
|
|
78
126
|
width: 100%;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
header {
|
|
130
|
+
background-color: var(--cdp-example-card-bg-color);
|
|
131
|
+
border-bottom: 1px solid var(--cdp-web-colors-border);
|
|
132
|
+
padding: 0.5rem 1rem;
|
|
133
|
+
width: 100%;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
header .wallet-address {
|
|
137
|
+
margin-right: 1rem;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.header-inner {
|
|
141
|
+
align-items: center;
|
|
79
142
|
display: flex;
|
|
80
143
|
flex-direction: column;
|
|
81
|
-
|
|
144
|
+
justify-content: space-between;
|
|
145
|
+
margin: 0 auto;
|
|
146
|
+
max-width: 75rem;
|
|
147
|
+
text-align: center;
|
|
82
148
|
}
|
|
83
149
|
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
|
|
150
|
+
.user-info {
|
|
151
|
+
justify-content: space-between;
|
|
152
|
+
width: 100%;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.user-icon {
|
|
156
|
+
flex-grow: 0;
|
|
157
|
+
flex-shrink: 0;
|
|
158
|
+
height: 1.25rem;
|
|
159
|
+
margin-right: 0.25rem;
|
|
160
|
+
width: auto;
|
|
87
161
|
}
|
|
88
162
|
|
|
89
163
|
.wallet-address {
|
|
90
164
|
font-family: monospace;
|
|
91
|
-
|
|
92
|
-
padding: 0.5rem;
|
|
93
|
-
border-radius: 4px;
|
|
94
|
-
font-size: 0.9rem;
|
|
165
|
+
font-size: 0.875rem;
|
|
95
166
|
word-break: break-all;
|
|
96
167
|
}
|
|
97
168
|
|
|
98
|
-
.
|
|
99
|
-
|
|
169
|
+
.main {
|
|
170
|
+
padding: 0.5rem;
|
|
171
|
+
width: 100%;
|
|
100
172
|
}
|
|
101
173
|
|
|
102
|
-
.
|
|
103
|
-
|
|
104
|
-
|
|
174
|
+
.main-inner {
|
|
175
|
+
gap: 1rem;
|
|
176
|
+
width: 100%;
|
|
105
177
|
}
|
|
106
178
|
|
|
107
|
-
.
|
|
108
|
-
|
|
179
|
+
.main-inner > .card {
|
|
180
|
+
width: 100%;
|
|
109
181
|
}
|
|
110
182
|
|
|
111
|
-
|
|
112
|
-
|
|
183
|
+
.site-title {
|
|
184
|
+
font-size: 1.2rem;
|
|
185
|
+
font-weight: 400;
|
|
186
|
+
line-height: 1.2;
|
|
113
187
|
margin: 0;
|
|
188
|
+
margin-bottom: 0.5rem;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.site-title br {
|
|
192
|
+
display: none;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.card {
|
|
196
|
+
align-items: center;
|
|
197
|
+
background-color: var(--cdp-example-card-bg-color);
|
|
198
|
+
border: 1px solid var(--cdp-web-colors-border);
|
|
199
|
+
border-radius: 1rem;
|
|
114
200
|
display: flex;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
201
|
+
flex-direction: column;
|
|
202
|
+
gap: 1rem;
|
|
203
|
+
justify-content: space-between;
|
|
204
|
+
max-width: var(--cdp-example-card-max-width);
|
|
205
|
+
padding: 2rem 1rem;
|
|
206
|
+
text-align: center;
|
|
207
|
+
width: 100%;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.card-title {
|
|
211
|
+
font-size: 1.25rem;
|
|
212
|
+
font-weight: 500;
|
|
213
|
+
line-height: 1.2;
|
|
214
|
+
margin: 0;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.loading--balance {
|
|
218
|
+
border-radius: 9999em;
|
|
219
|
+
display: inline-block;
|
|
220
|
+
height: 2.25rem;
|
|
221
|
+
width: 7rem;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.loading--text {
|
|
225
|
+
height: 1rem;
|
|
226
|
+
border-radius: 9999em;
|
|
227
|
+
margin: 0.25rem 0;
|
|
228
|
+
width: 20rem;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.loading--btn {
|
|
232
|
+
border-radius: 9999em;
|
|
233
|
+
height: 3.5rem;
|
|
234
|
+
width: 9.375rem;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.user-balance {
|
|
238
|
+
font-size: 1.5rem;
|
|
239
|
+
font-weight: 400;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.user-balance .flex-row-container {
|
|
243
|
+
justify-content: center;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.balance-icon {
|
|
247
|
+
flex-grow: 0;
|
|
248
|
+
flex-shrink: 0;
|
|
249
|
+
height: 1.5rem;
|
|
250
|
+
margin-right: 0.5rem;
|
|
251
|
+
width: auto;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.copy-address-button {
|
|
255
|
+
background-color: transparent;
|
|
256
|
+
border: 0;
|
|
257
|
+
color: var(--cdp-example-text-color);
|
|
258
|
+
cursor: pointer;
|
|
259
|
+
padding: 0;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
.copy-address-button:hover .user-icon--user,
|
|
263
|
+
.copy-address-button .user-icon--copy {
|
|
264
|
+
display: none;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.copy-address-button .user-icon--user,
|
|
268
|
+
.copy-address-button:hover .user-icon--copy {
|
|
269
|
+
display: inline;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.tx-button {
|
|
273
|
+
padding-left: 2rem;
|
|
274
|
+
padding-right: 2rem;
|
|
275
|
+
min-width: 11.75rem;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
@media (min-width: 540px) {
|
|
279
|
+
.header-inner {
|
|
280
|
+
flex-direction: row;
|
|
281
|
+
text-align: left;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.user-info {
|
|
285
|
+
width: auto;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.site-title {
|
|
289
|
+
margin-bottom: 0;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.site-title br {
|
|
293
|
+
display: inline;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.main {
|
|
297
|
+
padding: 1rem;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
@media (min-width: 860px) {
|
|
302
|
+
:root {
|
|
303
|
+
--cdp-example-card-max-width: 35rem;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.main-inner {
|
|
307
|
+
align-items: stretch;
|
|
308
|
+
flex-direction: row;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
@media (min-width: 1920px) {
|
|
313
|
+
:root {
|
|
314
|
+
--cdp-base-font-size: 20px;
|
|
315
|
+
}
|
|
119
316
|
}
|
|
@@ -4,11 +4,12 @@ import { createRoot } from "react-dom/client";
|
|
|
4
4
|
|
|
5
5
|
import App from "./App.tsx";
|
|
6
6
|
import { CDP_CONFIG } from "./config.ts";
|
|
7
|
+
import { theme } from "./theme.ts";
|
|
7
8
|
import "./index.css";
|
|
8
9
|
|
|
9
10
|
createRoot(document.getElementById("root")!).render(
|
|
10
11
|
<StrictMode>
|
|
11
|
-
<CDPReactProvider config={CDP_CONFIG}>
|
|
12
|
+
<CDPReactProvider config={CDP_CONFIG} theme={theme}>
|
|
12
13
|
<App />
|
|
13
14
|
</CDPReactProvider>
|
|
14
15
|
</StrictMode>,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type Theme } from "@coinbase/cdp-react/theme";
|
|
2
|
+
|
|
3
|
+
export const theme: Partial<Theme> = {
|
|
4
|
+
"colors-background": "var(--cdp-example-card-bg-color)",
|
|
5
|
+
"colors-backgroundOverlay": "var(--cdp-example-bg-overlay-color)",
|
|
6
|
+
"colors-backgroundSkeleton": "var(--cdp-example-bg-skeleton-color)",
|
|
7
|
+
"colors-text": "var(--cdp-example-text-color)",
|
|
8
|
+
"colors-textSecondary": "var(--cdp-example-text-secondary-color)",
|
|
9
|
+
"colors-border": "var(--cdp-example-card-border-color)",
|
|
10
|
+
"colors-primary": "var(--cdp-example-accent-color)",
|
|
11
|
+
"colors-primaryText": "var(--cdp-example-accent-foreground-color)",
|
|
12
|
+
"colors-primaryHoverBackground": "var(--cdp-example-accent-hover-color)",
|
|
13
|
+
"colors-primaryHoverText": "var(--cdp-example-accent-foreground-color)",
|
|
14
|
+
"colors-primaryFocusRing": "var(--cdp-example-accent-color)",
|
|
15
|
+
"colors-secondary": "var(--cdp-example-bg-low-contrast-color)",
|
|
16
|
+
"colors-secondaryText": "var(--cdp-example-text-color)",
|
|
17
|
+
"colors-secondaryHoverBackground": "var(--cdp-example-bg-low-contrast-color)",
|
|
18
|
+
"colors-secondaryHoverText": "var(--cdp-example-text-color)",
|
|
19
|
+
"colors-secondaryFocusRing": "var(--cdp-example-accent-color)",
|
|
20
|
+
"colors-inputBackground": "var(--cdp-example-card-bg-color)",
|
|
21
|
+
"colors-inputBorder": "var(--cdp-example-text-secondary-color)",
|
|
22
|
+
"colors-inputText": "var(--cdp-example-text-color)",
|
|
23
|
+
"colors-inputLabel": "var(--cdp-example-text-color)",
|
|
24
|
+
"colors-inputPlaceholder": "var(--cdp-example-text-secondary-color)",
|
|
25
|
+
"colors-inputFocusBorder": "var(--cdp-example-accent-color)",
|
|
26
|
+
"colors-linkText": "var(--cdp-example-accent-color)",
|
|
27
|
+
"colors-linkHover": "var(--cdp-example-accent-hover-color)",
|
|
28
|
+
"colors-linkSecondaryText": "var(--cdp-example-text-color)",
|
|
29
|
+
"colors-linkSecondaryHover": "var(--cdp-example-text-color)",
|
|
30
|
+
"fontFamily-sans": "var(--cdp-example-font-family)",
|
|
31
|
+
fontSizeBase: "var(--cdp-example-base-font-size)",
|
|
32
|
+
};
|