-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Implement WalletDropdownBaseName Sub-Component (#916)
- Loading branch information
Showing
10 changed files
with
199 additions
and
30 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
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
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,92 @@ | ||
import { | ||
ConnectWallet, | ||
Wallet, | ||
WalletDropdown, | ||
WalletDropdownLink, | ||
WalletDropdownBaseName, | ||
WalletDropdownDisconnect, | ||
} from '@coinbase/onchainkit/wallet'; | ||
import { | ||
Address, | ||
Avatar, | ||
Name, | ||
Identity, | ||
EthBalance, | ||
} from '@coinbase/onchainkit/identity'; | ||
import { color } from '@coinbase/onchainkit/theme'; | ||
import AppWithRK from '../../components/AppWithRK'; | ||
import WalletComponents from '../../components/WalletComponents'; | ||
|
||
# `<WalletDropdownBaseName />` | ||
|
||
The `WalletDropdownBaseName` component adds a [Basename](https://www.base.org/names) tab to the Wallet Component. This tab serves two purposes: | ||
|
||
1. For users with a Basename: It provides a link to their Base Name profile page. | ||
2. For users without a Basename: It provides a link to a page where they can create one. | ||
|
||
This component enhances the wallet interface by providing easy access to Base Name functionality, whether for viewing an existing profile or setting up a new one. | ||
|
||
## Usage | ||
|
||
```tsx | ||
import { | ||
ConnectWallet, | ||
Wallet, | ||
WalletDropdown, | ||
WalletDropdownBaseName, // [!code focus] | ||
WalletDropdownDisconnect, | ||
} from '@coinbase/onchainkit/wallet'; | ||
import { | ||
Address, | ||
Avatar, | ||
Name, | ||
Identity, | ||
EthBalance, | ||
} from '@coinbase/onchainkit/identity'; | ||
import { color } from '@coinbase/onchainkit/theme'; | ||
|
||
export function WalletComponents() { | ||
return ( | ||
<div className="flex justify-end"> | ||
<Wallet> | ||
<ConnectWallet> | ||
<Avatar className="h-6 w-6" /> | ||
<Name /> | ||
</ConnectWallet> | ||
<WalletDropdown> | ||
<Identity className="px-4 pt-3 pb-2" hasCopyAddressOnClick> | ||
<Avatar /> | ||
<Name /> | ||
<Address className={color.foregroundMuted} /> | ||
<EthBalance /> | ||
</Identity> | ||
<WalletDropdownBaseName /> // [!code focus] | ||
<WalletDropdownDisconnect /> | ||
</WalletDropdown> | ||
</Wallet> | ||
</div> | ||
); | ||
} | ||
``` | ||
|
||
<WalletComponents> | ||
<Wallet> | ||
<ConnectWallet text="Log In"> | ||
<Avatar className="h-6 w-6" /> | ||
<Name /> | ||
</ConnectWallet> | ||
<WalletDropdown> | ||
<Identity className="px-4 pt-3 pb-2" hasCopyAddressOnClick> | ||
<Avatar /> | ||
<Name /> | ||
<Address className={color.foregroundMuted} /> | ||
<EthBalance /> | ||
</Identity> | ||
<WalletDropdownBaseName /> | ||
<WalletDropdownDisconnect /> | ||
</WalletDropdown> | ||
</Wallet> | ||
</WalletComponents> | ||
|
||
## Props | ||
- [`WalletDropdownBaseNameReact`](/wallet/types#walletdropdownbasenamereact) |
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
Oops, something went wrong.