Skip to content

Commit aabe2a1

Browse files
committed
refactor(components): migrate extra-content to React JSX syntax
Simplified button rendering.
1 parent 8931982 commit aabe2a1

File tree

1 file changed

+37
-52
lines changed

1 file changed

+37
-52
lines changed
Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { Button, buttonVariants } from "@/components/ui/button";
2-
import { createElement } from "react";
1+
import { Button } from "@/components/ui/button";
32
import type { Chain, TransactionReceipt } from "viem";
43
import { generateBlockExplorerLink } from "@/lib/utils";
54

@@ -8,57 +7,43 @@ export const createExtraContent = (
87
hypercertId?: string,
98
chain?: Chain,
109
) => {
11-
const receiptButton =
12-
receipt &&
13-
createElement(
14-
"a",
15-
{
16-
href: generateBlockExplorerLink(chain, receipt.transactionHash),
17-
target: "_blank",
18-
rel: "noopener noreferrer",
19-
},
20-
createElement(
21-
Button,
22-
{
23-
size: "default",
24-
className: buttonVariants({ variant: "secondary" }),
25-
},
26-
"View transaction",
27-
),
28-
);
10+
const receiptButton = receipt && (
11+
<>
12+
<a
13+
href={generateBlockExplorerLink(chain, receipt.transactionHash)}
14+
target="_blank"
15+
rel="noopener noreferrer"
16+
>
17+
<Button size="default" variant={"secondary"}>
18+
View transaction
19+
</Button>
20+
</a>
21+
</>
22+
);
2923

30-
const hypercertButton =
31-
hypercertId &&
32-
createElement(
33-
"a",
34-
{
35-
href: `/hypercerts/${hypercertId}`,
36-
target: "_blank",
37-
rel: "noopener noreferrer",
38-
},
39-
createElement(
40-
Button,
41-
{
42-
size: "default",
43-
className: buttonVariants({ variant: "default" }),
44-
},
45-
"View hypercert",
46-
),
47-
);
24+
const hypercertButton = hypercertId && (
25+
<>
26+
<a
27+
href={`/hypercerts/${hypercertId}`}
28+
target="_blank"
29+
rel="noopener noreferrer"
30+
>
31+
<Button size="default" variant={"default"}>
32+
View hypercert
33+
</Button>
34+
</a>
35+
</>
36+
);
4837

49-
return createElement(
50-
"div",
51-
{ className: "flex flex-col space-y-2" },
52-
createElement(
53-
"p",
54-
{ className: "text-sm font-medium" },
55-
"Your hypercert has been minted successfully!",
56-
),
57-
createElement(
58-
"div",
59-
{ className: "flex space-x-4" },
60-
receiptButton,
61-
hypercertButton,
62-
),
38+
return (
39+
<div className="flex flex-col space-y-2">
40+
<p className="text-sm font-medium">
41+
Your hypercert has been minted successfully!
42+
</p>
43+
<div className="flex space-x-4">
44+
{receiptButton}
45+
{hypercertButton}
46+
</div>
47+
</div>
6348
);
6449
};

0 commit comments

Comments
 (0)