From e3129496db8878679530c55da8e7ef47dc61e095 Mon Sep 17 00:00:00 2001 From: Alec Chen <93971719+0xAlec@users.noreply.github.com> Date: Fri, 9 Aug 2024 09:39:23 -0700 Subject: [PATCH] docs --- site/docs/pages/wallet/types.mdx | 15 ++ .../wallet/wallet-dropdown-fund-link.mdx | 185 ++++++++++++++++++ site/sidebar.ts | 4 + 3 files changed, 204 insertions(+) create mode 100644 site/docs/pages/wallet/wallet-dropdown-fund-link.mdx diff --git a/site/docs/pages/wallet/types.mdx b/site/docs/pages/wallet/types.mdx index f60599d3bd..f5a68c8d55 100644 --- a/site/docs/pages/wallet/types.mdx +++ b/site/docs/pages/wallet/types.mdx @@ -86,3 +86,18 @@ export type WalletDropdownLinkReact = { target?: string; }; ``` + +## `WalletDropdownFundLinkReact` + +```ts +export type WalletDropdownFundLinkReact = { + className?: string; // Optional className override for the element + href: string; + icon?: ReactNode; + rel?: string; + target?: string; + text?: string; + type?: 'popup' | 'link'; + size?: 's' | 'm' | 'l'; +}; +``` diff --git a/site/docs/pages/wallet/wallet-dropdown-fund-link.mdx b/site/docs/pages/wallet/wallet-dropdown-fund-link.mdx new file mode 100644 index 0000000000..c21328a058 --- /dev/null +++ b/site/docs/pages/wallet/wallet-dropdown-fund-link.mdx @@ -0,0 +1,185 @@ +--- +title: Wallet Components & Utilities ยท OnchainKit +description: Introduction to Wallet Components & Utilities +--- + +import { + ConnectWallet, + Wallet, + WalletDropdown, + WalletDropdownLink, + WalletDropdownDisconnect, + WalletDropdownFundLink, +} from '../src/wallet'; +import { Address, Avatar, Name, Identity, EthBalance } from '../src/identity'; +import { color } from '@coinbase/onchainkit/theme'; +import AppWithRK from '../../components/AppWithRK'; +import WalletComponents from '../../components/WalletComponents'; + +# `` + +The Wallet Dropdown Fund Link provides an easy way for to access the [Funding](https://keys.coinbase.com/funding) flow for a Coinbase Smart Wallet. + +## Usage + +```tsx +import { + // [!code focus] + ConnectWallet, + Wallet, + WalletDropdown, + WalletDropdownLink, + WalletDropdownDisconnect, + WalletDropdownFundLink, // [!code focus] +} from '@coinbase/onchainkit/wallet'; // [!code focus] +import { + Address, + Avatar, + Name, + Identity, + EthBalance, +} from '@coinbase/onchainkit/identity'; +import { color } from '@coinbase/onchainkit/theme'; + +export function WalletComponents() { + return ( +
+ + + + + + // [!code focus] + + // [!code focus] + + + +
+ + + // [!code focus] + + Wallet + + + + + // [!code focus] +
+ ); +} +``` + + + + + + + + + + + Wallet + + + + + + +### Override text + +You can override component text using the `text` prop. + +```tsx +// omitted for brevity + + + + ... + + + ... + // [!code focus] + + +``` + + + + + + + + + + + + + + +### Open in window + +You can override default link behavior to open the funding flow in a popup window by using the `type` prop. + +```tsx +// omitted for brevity + + + + ... + + + ... + // [!code focus] + + +``` + + + + + + + + + + + + + + +### Customizing the window size + +When using popup mode, you're able to customize the size of the popup window using the `size` prop. Valid values are `s`, `m`, and `l`. + +```tsx +// omitted for brevity + + + + ... + + + ... + // [!code focus] + + +``` + + + + + + + + + + + + + + +## Props + +- [`WalletDropdownFundLinkReact`](/wallet/types#walletdropdownfundlinkreact) diff --git a/site/sidebar.ts b/site/sidebar.ts index c98cf18aa6..2d54fe9ec3 100644 --- a/site/sidebar.ts +++ b/site/sidebar.ts @@ -262,6 +262,10 @@ export const sidebar = [ text: 'Wallet', link: '/wallet/wallet', }, + { + text: 'WalletDropdownFundLink', + link: '/wallet/wallet-dropdown-fund-link', + }, ], }, {