-
Notifications
You must be signed in to change notification settings - Fork 356
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: improve react examples for the CLI (#778)
* improve design + funcionality react wagmi example * improve design + funcionality react wagmi example * improve design + funcionality react solana example * improve design + funcionality react multichain example * improve design + funcionality react multichain example * improve design + funcionality react ethers5 example * improve design + funcionality react ethers example * add env.test
- Loading branch information
Showing
82 changed files
with
14,376 additions
and
970 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
VITE_PROJECT_ID= |
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
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,42 +1,89 @@ | ||
#root { | ||
max-width: 1280px; | ||
margin: 0 auto; | ||
padding: 2rem; | ||
text-align: center; | ||
:root { | ||
--background: #ffffff; | ||
--foreground: #171717; | ||
} | ||
|
||
.logo { | ||
height: 6em; | ||
padding: 1.5em; | ||
will-change: filter; | ||
transition: filter 300ms; | ||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--background: #0a0a0a; | ||
--foreground: #ededed; | ||
} | ||
} | ||
.logo:hover { | ||
filter: drop-shadow(0 0 2em #646cffaa); | ||
|
||
html, | ||
body { | ||
max-width: 100vw; | ||
overflow-x: hidden; | ||
} | ||
.logo.react:hover { | ||
filter: drop-shadow(0 0 2em #61dafbaa); | ||
|
||
body { | ||
color: var(--foreground); | ||
background: var(--background); | ||
font-family: Arial, Helvetica, sans-serif; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
} | ||
|
||
@keyframes logo-spin { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
* { | ||
box-sizing: border-box; | ||
padding: 0; | ||
margin: 0; | ||
} | ||
|
||
@media (prefers-reduced-motion: no-preference) { | ||
a:nth-of-type(2) .logo { | ||
animation: logo-spin infinite 20s linear; | ||
a { | ||
color: inherit; | ||
text-decoration: none; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
html { | ||
color-scheme: dark; | ||
} | ||
} | ||
|
||
.card { | ||
padding: 2em; | ||
section { | ||
border: 1px solid #e0e0e0; | ||
border-radius: 8px; | ||
padding: 16px; | ||
background-color: #f9f9f9; | ||
padding: 13px; | ||
margin: 10px; | ||
width:100% | ||
} | ||
|
||
.read-the-docs { | ||
color: #888; | ||
.pages { | ||
|
||
align-items: center; | ||
justify-items: center; | ||
} | ||
|
||
:root { | ||
justify-items: center; | ||
} | ||
|
||
button { | ||
padding: 10px 20px; | ||
background-color: white; | ||
color: black; | ||
border: 2px solid black; | ||
border-radius: 6px; | ||
font-size: 16px; | ||
font-weight: 600; | ||
cursor: pointer; | ||
transition: all 0.3s ease; | ||
margin: 20px; /* Space between buttons */ | ||
} | ||
|
||
button:hover { | ||
background-color: black; | ||
color: white; | ||
} | ||
|
||
button:active { | ||
background-color: #333; /* Dark gray on click */ | ||
color: white; | ||
} | ||
|
||
h1 { | ||
margin: 20px; | ||
} |
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
15 changes: 15 additions & 0 deletions
15
dapps/appkit/react-ethers/src/components/ActionButtonList.tsx
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,15 @@ | ||
import { useDisconnect, useAppKit, useAppKitNetwork } from '@reown/appkit/react' | ||
import { networks } from '../config' | ||
|
||
export const ActionButtonList = () => { | ||
const { disconnect } = useDisconnect(); | ||
const { open } = useAppKit(); | ||
const { switchNetwork } = useAppKitNetwork(); | ||
return ( | ||
<div > | ||
<button onClick={() => open()}>Open</button> | ||
<button onClick={() => disconnect()}>Disconnect</button> | ||
<button onClick={() => switchNetwork(networks[1]) }>Switch</button> | ||
</div> | ||
) | ||
} |
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,59 @@ | ||
import { useEffect } from 'react' | ||
import { | ||
useAppKitState, | ||
useAppKitTheme, | ||
useAppKitEvents, | ||
useAppKitAccount, | ||
useWalletInfo | ||
} from '@reown/appkit/react' | ||
|
||
export const InfoList = () => { | ||
const { themeMode, themeVariables } = useAppKitTheme(); | ||
const state = useAppKitState(); | ||
const {address, caipAddress, isConnected, status} = useAppKitAccount(); | ||
const events = useAppKitEvents() | ||
const walletInfo = useWalletInfo() | ||
|
||
useEffect(() => { | ||
console.log("Events: ", events); | ||
}, [events]); | ||
|
||
return ( | ||
<div > | ||
<section> | ||
<h2>useAppKit</h2> | ||
<pre> | ||
Address: {address}<br /> | ||
caip Address: {caipAddress}<br /> | ||
Connected: {isConnected.toString()}<br /> | ||
Status: {status}<br /> | ||
</pre> | ||
</section> | ||
|
||
<section> | ||
<h2>Theme</h2> | ||
<pre> | ||
Theme: {themeMode}<br /> | ||
ThemeVariables: { JSON.stringify(themeVariables, null, 2)}<br /> | ||
</pre> | ||
</section> | ||
|
||
<section> | ||
<h2>State</h2> | ||
<pre> | ||
activeChain: {state.activeChain}<br /> | ||
loading: {state.loading.toString()}<br /> | ||
open: {state.open.toString()}<br /> | ||
selectedNetworkId: {state.selectedNetworkId?.toString()}<br /> | ||
</pre> | ||
</section> | ||
|
||
<section> | ||
<h2>WalletInfo</h2> | ||
<pre> | ||
Name: {walletInfo.walletInfo?.name?.toString()}<br /> | ||
</pre> | ||
</section> | ||
</div> | ||
) | ||
} |
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,24 @@ | ||
import { mainnet, arbitrum } from '@reown/appkit/networks' | ||
import type { AppKitNetwork } from '@reown/appkit/networks' | ||
import { EthersAdapter } from '@reown/appkit-adapter-ethers' | ||
|
||
// Get projectId from https://cloud.reown.com | ||
export const projectId = import.meta.env.VITE_PROJECT_ID | ||
|
||
if (!projectId) { | ||
throw new Error('Project ID is not defined') | ||
} | ||
|
||
// Create a metadata object - optional | ||
export const metadata = { | ||
name: 'AppKit', | ||
description: 'AppKit Example', | ||
url: 'https://reown.com', // origin must match your domain & subdomain | ||
icons: ['https://avatars.githubusercontent.com/u/179229932'] | ||
} | ||
|
||
// for custom networks visit -> https://docs.reown.com/appkit/react/core/custom-networks | ||
export const networks = [mainnet, arbitrum] as [AppKitNetwork, ...AppKitNetwork[]] | ||
|
||
// Set up Solana Adapter | ||
export const ethersAdapter = new EthersAdapter(); |
Oops, something went wrong.