1
1
import { MultiNetworkSelector } from "@/components/blocks/NetworkSelectors" ;
2
- import { Flex , FormControl , Select } from "@chakra-ui/react" ;
2
+ import {
3
+ Select ,
4
+ SelectContent ,
5
+ SelectItem ,
6
+ SelectTrigger ,
7
+ SelectValue ,
8
+ } from "@/components/ui/select" ;
9
+ import { cn } from "@/lib/utils" ;
3
10
import { useFormContext } from "react-hook-form" ;
4
11
import type { ThirdwebClient } from "thirdweb" ;
5
12
import { Heading , Text } from "tw-components" ;
@@ -16,30 +23,32 @@ export const NetworksFieldset: React.FC<NetworksFieldsetProps> = ({
16
23
const form = useFormContext ( ) ;
17
24
18
25
return (
19
- < Flex flexDir = "column" gap = { fromStandard ? 6 : 4 } >
20
- < Flex flexDir = "column" gap = { 2 } >
26
+ < div className = { cn ( "flex flex-col" , fromStandard ? "gap-6" : "gap-4" ) } >
27
+ < div className = "flex flex-col gap-2" >
21
28
< Heading size = { fromStandard ? "title.lg" : "title.md" } >
22
29
Networks that your contract can be deployed to
23
30
</ Heading >
24
- </ Flex >
25
- < FormControl isRequired >
31
+ </ div >
32
+ < div className = "flex flex-col gap-2" data-required >
26
33
< Select
27
- onChange = { ( e ) =>
28
- form . setValue (
29
- "networksForDeployment.allNetworks" ,
30
- e . target . value === "all" ,
31
- )
32
- }
33
34
value = {
34
35
form . watch ( "networksForDeployment.allNetworks" ) ? "all" : "specific"
35
36
}
37
+ onValueChange = { ( value ) =>
38
+ form . setValue ( "networksForDeployment.allNetworks" , value === "all" )
39
+ }
36
40
>
37
- < option value = "all" > All networks</ option >
38
- < option value = "specific" > Specific networks</ option >
41
+ < SelectTrigger className = "w-full" >
42
+ < SelectValue />
43
+ </ SelectTrigger >
44
+ < SelectContent >
45
+ < SelectItem value = "all" > All networks</ SelectItem >
46
+ < SelectItem value = "specific" > Specific networks</ SelectItem >
47
+ </ SelectContent >
39
48
</ Select >
40
- </ FormControl >
49
+ </ div >
41
50
{ ! form . watch ( "networksForDeployment.allNetworks" ) && (
42
- < Flex flexDir = "column" gap = { 2 } >
51
+ < div className = "flex flex-col gap-2" >
43
52
< Text > Please select the networks you want to enable:</ Text >
44
53
< MultiNetworkSelector
45
54
client = { client }
@@ -50,8 +59,8 @@ export const NetworksFieldset: React.FC<NetworksFieldsetProps> = ({
50
59
form . watch ( "networksForDeployment.networksEnabled" ) || [ ]
51
60
}
52
61
/>
53
- </ Flex >
62
+ </ div >
54
63
) }
55
- </ Flex >
64
+ </ div >
56
65
) ;
57
66
} ;
0 commit comments