Skip to content

Commit

Permalink
Feat: Cleanup Components (#2)
Browse files Browse the repository at this point in the history
* feat: cleanup primitives

* feat: add wagmi components

* fix: transaction demo hash

* feat: move account components to primitives

* feat: add erc20 and erc721 components

* chore: add erc20 select back to docs

* fix: formatting
  • Loading branch information
marthendalnunes authored Nov 30, 2023
1 parent 19342e8 commit b7216df
Show file tree
Hide file tree
Showing 229 changed files with 25,062 additions and 19,747 deletions.
2 changes: 1 addition & 1 deletion apps/www/__registry__/README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Files are auto-generated. Do not edit!
Files are auto-generated. Do not edit!
318 changes: 208 additions & 110 deletions apps/www/__registry__/index.tsx

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions apps/www/app/examples/authentication/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Metadata } from "next"
import Image from "next/image"
import Link from "next/link"

import { cn } from "@/lib/utils"
import { AccountAddress } from "@/registry/default/buidl/account-address"
import { AccountBlockie } from "@/registry/default/buidl/account-blockie"
import { Address } from "@/registry/default/buidl/address"
import { Blockie } from "@/registry/default/buidl/blockie"
import { IsWalletConnected } from "@/registry/default/buidl/is-wallet-connected"
import { IsWalletDisconnected } from "@/registry/default/buidl/is-wallet-disconnected"
import { WalletConnect } from "@/registry/default/buidl/wallet-connect"
Expand Down Expand Up @@ -91,9 +89,9 @@ export default function AuthenticationPage() {
</IsWalletDisconnected>
<IsWalletConnected>
<div className="flex items-center justify-center gap-x-2">
<AccountBlockie />
<Blockie />
<Button size={"sm"} className="rounded-full">
<AccountAddress truncate linkEnabled />
<Address truncate link />
</Button>
<WalletDisconnect variant={"ghost"} size={"sm"} />
</div>
Expand Down
107 changes: 71 additions & 36 deletions apps/www/config/docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,6 @@ export const docsConfig: DocsConfig = {
href: "/docs/components/is-wallet-disconnected",
items: [],
},
{
title: "(WIP) Wallet Manage",
href: "/docs/components/wallet-manage",
items: [],
},
{
title: "(WIP) Network Manage",
href: "/docs/components/network-manage",
items: [],
},
],
},
{
Expand All @@ -90,11 +80,46 @@ export const docsConfig: DocsConfig = {
href: "/docs/components/address",
items: [],
},
{
title: "Balance",
href: "/docs/components/balance",
items: [],
},
{
title: "Block Explorer Link",
href: "/docs/components/block-explorer-link",
items: [],
},
{
title: "Block Number",
href: "/docs/components/block-number",
items: [],
},
{
title: "Nonce",
href: "/docs/components/nonce",
items: [],
},
{
title: "Transaction",
href: "/docs/components/transaction",
items: [],
},
{
title: "Transaction Status",
href: "/docs/components/transaction-status",
items: [],
},
{
title: "Fee Data",
href: "/docs/components/fee-data",
items: [],
},
{
title: "Sign Message Button",
href: "/docs/components/sign-message-button",
items: [],
},
{
title: "Blockie",
href: "/docs/components/blockie",
Expand All @@ -110,6 +135,11 @@ export const docsConfig: DocsConfig = {
href: "/docs/components/ens-name",
items: [],
},
{
title: "ENS Address",
href: "/docs/components/ens-address",
items: [],
},
{
title: "Image IPFS",
href: "/docs/components/image-ipfs",
Expand All @@ -118,71 +148,76 @@ export const docsConfig: DocsConfig = {
],
},
{
title: "Account",
title: "ERC20",
items: [
{
title: "Account Address",
href: "/docs/components/account-address",
title: "ERC20 Balance",
href: "/docs/components/erc20-balance",
items: [],
},
{
title: "Account Balance",
href: "/docs/components/account-balance",
title: "ERC20 Decimals",
href: "/docs/components/erc20-decimals",
items: [],
},
{
title: "Account Blockie",
href: "/docs/components/account-blockie",
title: "ERC20 Name",
href: "/docs/components/erc20-name",
items: [],
},
{
title: "ERC20 Symbol",
href: "/docs/components/erc20-symbol",
items: [],
},
{
title: "Account ENS Avatar",
href: "/docs/components/account-ens-avatar",
title: "ERC20 Total Supply",
href: "/docs/components/erc20-total-supply",
items: [],
},
{
title: "Account ENS Name",
href: "/docs/components/account-ens-name",
title: "ERC20 Select",
href: "/docs/components/erc20-select",
items: [],
},
{
title: "Account Nonce",
href: "/docs/components/account-nonce",
title: "ERC20 Select and Amount",
href: "/docs/components/erc20-select-and-amount",
items: [],
},
],
},
{
title: "ERC20",
title: "ERC721",
items: [
{
title: "ERC20 Balance",
href: "/docs/components/erc20-balance",
title: "ERC721 Name",
href: "/docs/components/erc721-name",
items: [],
},
{
title: "ERC20 Image",
href: "/docs/components/erc20-image",
title: "ERC721 Symbol",
href: "/docs/components/erc721-symbol",
items: [],
},
{
title: "ERC20 Name",
href: "/docs/components/erc20-name",
title: "ERC721 Owner Of",
href: "/docs/components/erc721-owner-of",
items: [],
},
{
title: "ERC20 Symbol",
href: "/docs/components/erc20-symbol",
title: "ERC721 Total Supply",
href: "/docs/components/erc721-total-supply",
items: [],
},
{
title: "ERC20 Select",
href: "/docs/components/erc20-select",
title: "ERC721 Token URI",
href: "/docs/components/erc721-token-uri",
items: [],
},
{
title: "ERC20 Select & Amount",
href: "/docs/components/erc20-select-and-amount",
title: "ERC721 Metadata",
href: "/docs/components/erc721-metadata",
items: [],
},
],
Expand Down
34 changes: 12 additions & 22 deletions apps/www/config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,25 @@
import { env } from "@/env.mjs"
import { Chain, ChainProviderFn, configureChains } from "wagmi"
import {
goerli as goerliNoIcon,
arbitrum,
base,
gnosis,
mainnet,
optimism,
optimismGoerli,
sepolia as sepoliaNoIcon,
polygon,
} from "wagmi/chains"
import { alchemyProvider } from "wagmi/providers/alchemy"
import { infuraProvider } from "wagmi/providers/infura"
import { publicProvider } from "wagmi/providers/public"

const goerli = {
...goerliNoIcon,
iconUrl: "/icons/NetworkEthereumTest.svg",
}
const sepolia = {
...sepoliaNoIcon,
iconUrl: "/icons/NetworkEthereumTest.svg",
}

export const ETH_CHAINS_TEST = [goerli, sepolia, optimismGoerli]

export const ETH_CHAINS_PROD = [mainnet, optimism]
export const ETH_CHAINS_DEV =
env.NEXT_PUBLIC_PROD_NETWORKS_DEV === "true"
? [...ETH_CHAINS_PROD, ...ETH_CHAINS_TEST]
: [...ETH_CHAINS_TEST]

export const CHAINS: Chain[] =
process.env.NODE_ENV === "production" ? ETH_CHAINS_PROD : ETH_CHAINS_DEV
export const CHAINS: Chain[] = [
mainnet,
optimism,
polygon,
gnosis,
arbitrum,
base,
]

const PROVIDERS: ChainProviderFn<Chain>[] = []

Expand Down
18 changes: 16 additions & 2 deletions apps/www/content/docs/components/address.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,23 @@ wagmi:
## Usage

```tsx
import { Address } from "@/components/buidl/address"
import {
Address,
AddressCopy,
AddressLink,
} from "@/registry/default/buidl/address"
```

```tsx
<Address />
<Address address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />

<Address link address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />
<AddressLink address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />

<Address copy address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />
<AddressCopy address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />

<Address truncate address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />

<Address link copy truncate address={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: Account ENS Avatar
description: Display the connected account ENS avatar.
title: Balance
description: Displays the balance of an address.
component: true
wagmi:
link: https://wagmi.sh/react/hooks/useEnsAvatar
link: https://wagmi.sh/react/hooks/useBalance
---

<ComponentPreview
name="account-ens-avatar-demo"
name="balance-demo"
className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"
/>

Expand Down Expand Up @@ -36,13 +36,13 @@ wagmi:

<Steps>

<Step>Install the following components:</Step>
<Step>Install the following shadcn/ui components:</Step>

- [EnsAvatar](/docs/components/ens-avatar)
- [Skeleton](https://ui.shadcn.com/docs/components/skeleton)

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="account-ens-avatar" />
<ComponentSource name="balance" />

</Steps>

Expand All @@ -53,9 +53,15 @@ wagmi:
## Usage

```tsx
import { AccountEnsAvatar } from "@/components/buidl/account-ens-avatar"
import {
GasPrice,
MaxFeePerGas,
MaxPriorityFeePerGas,
} from "@/registry/default/buidl/balance"
```

```tsx
<AccountEnsAvatar />
<GasPrice />
<MaxFeePerGas />
<MaxPriorityFeePerGas />
```
8 changes: 5 additions & 3 deletions apps/www/content/docs/components/block-explorer-link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ wagmi:
## Usage

```tsx
import { WalletConnect } from "@/components/buidl/wallet-connect"
import { BlockExplorerLink } from "@/registry/default/buidl/block-explorer-link"
```

```tsx
<WalletConnect />
<WalletConnect>Custom Text</WalletConnect>
<BlockExplorerLink data={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} />
<BlockExplorerLink data={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"} showBlockExplorerName />
<BlockExplorerLink data={"0x761d584f1C2d43cBc3F42ECd739701a36dFFAa31"}>Go to Block Explorer</BlockExplorerLink>
<BlockExplorerLink type="tx" data="0x827069d50d3a5ec0d19327f4b1bb1ecfbe939ef26bc3b6cc2dae5a1574f1e6f8"/>
```
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---
title: Account ENS Name
description: Display the connected account ENS name.
title: Block Number
description: Displays the current block number of a network.
component: true
wagmi:
link: https://wagmi.sh/react/hooks/useAccount
link: https://wagmi.sh/react/hooks/useBlockNumber
---

<ComponentPreview
name="account-ens-name-demo"
name="block-number-demo"
className="[&_.preview>[data-orientation=vertical]]:sm:max-w-[70%]"
/>

Expand Down Expand Up @@ -36,13 +36,13 @@ wagmi:

<Steps>

<Step>Install the following components:</Step>
<Step>Install the following shadcn/ui components:</Step>

- [EnsName](/docs/components/ens-name)
- [Skeleton](https://ui.shadcn.com/docs/components/skeleton)

<Step>Copy and paste the following code into your project.</Step>

<ComponentSource name="account-ens-name" />
<ComponentSource name="block-number" />

</Steps>

Expand All @@ -53,9 +53,9 @@ wagmi:
## Usage

```tsx
import { AccountEnsName } from "@/components/buidl/account-ens-name"
import { BlockNumber } from "@/registry/default/buidl/block-number"
```

```tsx
<AccountEnsName />
<BlockNumber />
```
Loading

0 comments on commit b7216df

Please sign in to comment.