Skip to content

Commit 6c35284

Browse files
committed
Dashboard: Migrate contract overview page components to tailwind/shadcn #1
1 parent f2abc8b commit 6c35284

File tree

3 files changed

+215
-212
lines changed

3 files changed

+215
-212
lines changed
Lines changed: 36 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,41 @@
1-
"use client";
1+
import { TrackedLinkTW } from "@/components/ui/tracked-link";
2+
import { ReactIcon } from "../../../../../../../components/icons/brand-icons/ReactIcon";
3+
import { TypeScriptIcon } from "../../../../../../../components/icons/brand-icons/TypeScriptIcon";
24

3-
import {
4-
Flex,
5-
GridItem,
6-
LinkBox,
7-
LinkOverlay,
8-
SimpleGrid,
9-
} from "@chakra-ui/react";
10-
import { ChakraNextImage as Image } from "components/Image";
11-
import { PRODUCTS } from "components/product-pages/common/nav/data";
12-
import { Card } from "tw-components/card";
13-
import { TrackedLink, type TrackedLinkProps } from "tw-components/link";
14-
import { Text } from "tw-components/text";
15-
16-
const RENDERED_PRODUCTS = ["sdk", "storage", "ui-components", "auth"];
17-
18-
interface BuildYourAppProps {
19-
trackingCategory: TrackedLinkProps["category"];
5+
export function BuildYourApp(props: {
6+
trackingCategory: string;
207
contractAddress: string;
218
chainSlug: string;
22-
}
23-
24-
export const BuildYourApp: React.FC<BuildYourAppProps> = ({
25-
trackingCategory,
26-
contractAddress,
27-
chainSlug,
28-
}) => {
9+
}) {
2910
return (
30-
<Card
31-
px={{ base: 4, md: 8 }}
32-
py={{ base: 6, md: 8 }}
33-
as={LinkBox}
34-
transition="all 0.2s"
35-
_hover={{ borderColor: "whiteAlpha.300" }}
36-
>
37-
<SimpleGrid {...{ columns: { base: 1, md: 2 } }} gap={8}>
38-
<GridItem as={Flex} direction="column" gap={4}>
39-
<h2 className="font-semibold text-2xl tracking-tight">
40-
Build your app
41-
</h2>
42-
<Text size="body.md">
43-
<LinkOverlay
44-
as={TrackedLink}
45-
category={trackingCategory}
46-
label="build_your_app"
47-
href={`/${chainSlug}/${contractAddress}/code`}
48-
color="blue.500"
49-
>
50-
Learn more
51-
</LinkOverlay>{" "}
52-
about how you can use thirdweb tools to build apps on top of this
53-
contract.
54-
</Text>
55-
</GridItem>
56-
<GridItem as={Flex} align="center" justify="end" gap={3}>
57-
{RENDERED_PRODUCTS.map((p) => {
58-
const product = PRODUCTS.find((item) => item.label === p);
59-
return (
60-
product?.icon && (
61-
<Flex
62-
key={product.name}
63-
rounded="full"
64-
bg="#0E0E10"
65-
align="center"
66-
justify="center"
67-
w={14}
68-
h={14}
69-
>
70-
<Image boxSize={7} src={product.icon} alt={product.name} />
71-
</Flex>
72-
)
73-
);
74-
})}
75-
</GridItem>
76-
</SimpleGrid>
77-
</Card>
11+
<div className="relative flex flex-col justify-between gap-4 rounded-lg border bg-card p-6 hover:border-active-border md:grid-cols-2 lg:flex-row">
12+
{/* left */}
13+
<div className="max-w-sm">
14+
<h2 className="mb-2 font-semibold text-xl leading-none tracking-tight">
15+
Build your app
16+
</h2>
17+
<TrackedLinkTW
18+
category={props.trackingCategory}
19+
label="build_your_app"
20+
href={`/${props.chainSlug}/${props.contractAddress}/code`}
21+
className="block text-balance text-muted-foreground text-sm before:absolute before:inset-0"
22+
>
23+
Learn more about how you can use thirdweb tools to build apps on top
24+
of this contract
25+
</TrackedLinkTW>{" "}
26+
</div>
27+
28+
{/* right */}
29+
<div className="flex items-center justify-end gap-3">
30+
{[TypeScriptIcon, ReactIcon].map((Icon, i) => {
31+
return (
32+
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
33+
<div key={i} className="rounded-full border bg-background p-3">
34+
<Icon className="size-5 text-muted-foreground" />
35+
</div>
36+
);
37+
})}
38+
</div>
39+
</div>
7840
);
79-
};
41+
}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { ThirdwebProvider } from "thirdweb/react";
3+
import { PermissionsTableUI } from "./PermissionsTable";
4+
5+
const meta: Meta<typeof PermissionsTableUI> = {
6+
title: "Contracts/Overview/PermissionsTable",
7+
component: PermissionsTableUI,
8+
decorators: [
9+
(Story) => (
10+
<ThirdwebProvider>
11+
<div className="container max-w-4xl py-10">
12+
<Story />
13+
</div>
14+
</ThirdwebProvider>
15+
),
16+
],
17+
args: {
18+
viewMoreLink: "#",
19+
trackingCategory: "test-category",
20+
members: [],
21+
isPending: false,
22+
},
23+
};
24+
25+
export default meta;
26+
type Story = StoryObj<typeof PermissionsTableUI>;
27+
28+
// Story for loading state
29+
export const Loading: Story = {
30+
args: {
31+
isPending: true,
32+
members: [],
33+
},
34+
};
35+
36+
// Story for empty state (no members)
37+
export const NoMembers: Story = {
38+
args: {
39+
isPending: false,
40+
members: [],
41+
},
42+
};
43+
44+
// Story with one member
45+
export const OneMember: Story = {
46+
args: {
47+
isPending: false,
48+
members: [
49+
{
50+
member: "0x1F846F6DAE38E1C88D71EAA191760B15f38B7A37",
51+
roles: ["admin"],
52+
},
53+
],
54+
},
55+
};
56+
57+
// Story with five members and various roles
58+
export const FiveMembers: Story = {
59+
args: {
60+
isPending: false,
61+
members: [
62+
{
63+
member: "0x1F846F6DAE38E1C88D71EAA191760B15f38B7A37",
64+
roles: ["admin", "minter"],
65+
},
66+
{
67+
member: "0x83Dd93fA5D8343094f850f90B3fb90088C1bB425",
68+
roles: ["transfer"],
69+
},
70+
{
71+
member: "0x1f4202eD5c33d229bCda7B9B6AB3B57caDf423e6",
72+
roles: ["admin", "pauser", "upgrader"],
73+
},
74+
{
75+
member: "0x6844F0056d4C84CA2a894Fcf85473d75d8252b24",
76+
roles: [
77+
"admin",
78+
"minter",
79+
"pauser",
80+
"upgrader",
81+
"transfer",
82+
"burner",
83+
"manager",
84+
"lister",
85+
],
86+
},
87+
],
88+
},
89+
};

0 commit comments

Comments
 (0)