From 2b5080d90177b2a5f72b5c37482a0d32e7091338 Mon Sep 17 00:00:00 2001 From: kien-ngo Date: Sat, 14 Dec 2024 11:27:08 +0000 Subject: [PATCH] Playground: Examples for Wallet components (#5692) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem solved Short description of the bug fixed or feature added --- ## PR-Codex overview This PR introduces a new `Wallet` navigation link and implements a new `Wallet` page with components for displaying wallet icons and names, enhancing the user interface for crypto wallet applications. ### Detailed summary - Added a new navigation link for `Wallet`. - Created `page.tsx` for the `Wallet` section with metadata and layout. - Implemented `APIHeader` for the `Wallet` page. - Added three components: `WalletIconBasic`, `WalletNameBasic`, and `WalletNameFormat` in `wallet-examples.tsx`. - Each component includes a description and code example for usage. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` --- .../src/app/connect/ui/wallet/page.tsx | 49 ++++++++ apps/playground-web/src/app/navLinks.ts | 4 + .../headless-ui/wallet-examples.tsx | 109 ++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 apps/playground-web/src/app/connect/ui/wallet/page.tsx create mode 100644 apps/playground-web/src/components/headless-ui/wallet-examples.tsx diff --git a/apps/playground-web/src/app/connect/ui/wallet/page.tsx b/apps/playground-web/src/app/connect/ui/wallet/page.tsx new file mode 100644 index 00000000000..e97a2dd5599 --- /dev/null +++ b/apps/playground-web/src/app/connect/ui/wallet/page.tsx @@ -0,0 +1,49 @@ +import { APIHeader } from "@/components/blocks/APIHeader"; +import { + WalletIconBasic, + WalletNameBasic, + WalletNameFormat, +} from "@/components/headless-ui/wallet-examples"; + +import ThirdwebProvider from "@/components/thirdweb-provider"; +import { metadataBase } from "@/lib/constants"; +import type { Metadata } from "next"; + +export const metadata: Metadata = { + metadataBase, + title: "Wallet Components", + description: + "Boost your crypto wallet applications with our React headless UI components, optimized for digital asset management. These flexible, unstyled elements simplify cryptocurrency operations while granting developers complete control over the user interface design.", +}; + +export default function Page() { + return ( + +
+ + Boost your crypto wallet applications with our React headless UI + components, optimized for digital asset management. These + flexible, unstyled elements simplify cryptocurrency operations + while granting developers complete control over the user interface + design. + + } + docsLink="https://portal.thirdweb.com/react/v5/connecting-wallets/ui-components" + heroLink="/headless-ui-header.png" + /> +
+ +
+
+ +
+
+ +
+
+
+ ); +} diff --git a/apps/playground-web/src/app/navLinks.ts b/apps/playground-web/src/app/navLinks.ts index 69b11575838..241234ffd50 100644 --- a/apps/playground-web/src/app/navLinks.ts +++ b/apps/playground-web/src/app/navLinks.ts @@ -131,6 +131,10 @@ export const navLinks: SidebarLink[] = [ name: "Chain", href: "/connect/ui/chain", }, + { + name: "Wallet", + href: "/connect/ui/wallet", + }, ], }, ]; diff --git a/apps/playground-web/src/components/headless-ui/wallet-examples.tsx b/apps/playground-web/src/components/headless-ui/wallet-examples.tsx new file mode 100644 index 00000000000..c91788eae2d --- /dev/null +++ b/apps/playground-web/src/components/headless-ui/wallet-examples.tsx @@ -0,0 +1,109 @@ +"use client"; + +import { WalletIcon, WalletName, WalletProvider } from "thirdweb/react"; +import { CodeExample } from "../code/code-example"; + +export function WalletIconBasic() { + return ( + <> +
+

+ WalletIcon +

+

+ Show the icon of a crypto wallet +

+
+ + + Loading...} + /> + + } + code={`import { WalletProvider, WalletIcon } from "thirdweb/react"; + +function App() { + return ( + + Loading...} + /> + + ) +}`} + lang="tsx" + /> + + ); +} + +export function WalletNameBasic() { + return ( + <> +
+

+ WalletName +

+

+ Show the name of a crypto wallet +

+
+ + + Loading...} /> + + } + code={`import { WalletProvider, WalletName } from "thirdweb/react"; + +function App() { + return ( + + Loading...} /> + + ) +}`} + lang="tsx" + /> + + ); +} + +export function WalletNameFormat() { + return ( + <> +
+

+ Transform the wallet name using the formatFn prop. +

+
+ + + `${str} Wallet`} /> + + } + code={`import { WalletProvider, WalletName } from "thirdweb/react"; + +function App() { + return ( + + Loading...} + formatFn={(str: string) => \`\${str} Wallet\`} + /> + + ) +}`} + lang="tsx" + /> + + ); +}