Skip to content

Playground: Examples for Wallet components #5692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 49 additions & 0 deletions apps/playground-web/src/app/connect/ui/wallet/page.tsx
Original file line number Diff line number Diff line change
@@ -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 (
<ThirdwebProvider>
<main className="container px-0 pb-20">
<APIHeader
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.
</>
}
docsLink="https://portal.thirdweb.com/react/v5/connecting-wallets/ui-components"
heroLink="/headless-ui-header.png"
/>
<section className="space-y-8">
<WalletIconBasic />
</section>
<section className="space-y-8">
<WalletNameBasic />
</section>
<section className="space-y-8">
<WalletNameFormat />
</section>
</main>
</ThirdwebProvider>
);
}
4 changes: 4 additions & 0 deletions apps/playground-web/src/app/navLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ export const navLinks: SidebarLink[] = [
name: "Chain",
href: "/connect/ui/chain",
},
{
name: "Wallet",
href: "/connect/ui/wallet",
},
],
},
];
109 changes: 109 additions & 0 deletions apps/playground-web/src/components/headless-ui/wallet-examples.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
"use client";

import { WalletIcon, WalletName, WalletProvider } from "thirdweb/react";
import { CodeExample } from "../code/code-example";

export function WalletIconBasic() {
return (
<>
<div className="space-y-2">
<h2 className="font-semibold text-2xl tracking-tight sm:text-3xl">
WalletIcon
</h2>
<p className="max-w-[600px] text-lg">
Show the icon of a crypto wallet
</p>
</div>

<CodeExample
preview={
<WalletProvider id="io.metamask">
<WalletIcon
className="h-20 w-20 rounded-full"
loadingComponent={<span>Loading...</span>}
/>
</WalletProvider>
}
code={`import { WalletProvider, WalletIcon } from "thirdweb/react";

function App() {
return (
<WalletProvider id="io.metamask">
<WalletIcon
className="h-20 w-20 rounded-full"
loadingComponent={<span>Loading...</span>}
/>
</WalletProvider>
)
}`}
lang="tsx"
/>
</>
);
}

export function WalletNameBasic() {
return (
<>
<div className="mt-8 space-y-2">
<h2 className="font-semibold text-2xl tracking-tight sm:text-3xl">
WalletName
</h2>
<p className="max-w-[600px] text-lg">
Show the name of a crypto wallet
</p>
</div>

<CodeExample
preview={
<WalletProvider id="io.metamask">
<WalletName loadingComponent={<span>Loading...</span>} />
</WalletProvider>
}
code={`import { WalletProvider, WalletName } from "thirdweb/react";

function App() {
return (
<WalletProvider id="io.metamask">
<WalletName loadingComponent={<span>Loading...</span>} />
</WalletProvider>
)
}`}
lang="tsx"
/>
</>
);
}

export function WalletNameFormat() {
return (
<>
<div className="mt-8 space-y-2">
<p className="max-w-[600px] text-lg">
Transform the wallet name using the <b>formatFn</b> prop.
</p>
</div>

<CodeExample
preview={
<WalletProvider id="io.metamask">
<WalletName formatFn={(str: string) => `${str} Wallet`} />
</WalletProvider>
}
code={`import { WalletProvider, WalletName } from "thirdweb/react";

function App() {
return (
<WalletProvider id="io.metamask">
<WalletName
loadingComponent={<span>Loading...</span>}
formatFn={(str: string) => \`\${str} Wallet\`}
/>
</WalletProvider>
)
}`}
lang="tsx"
/>
</>
);
}
Loading