@@ -42,7 +42,9 @@ export function GenerateCodeDialog({
4242} : GenerateCodeDialogProps ) {
4343 const [ formattedCode , setFormattedCode ] = useState ( generatedCode . code ) ;
4444 const [ copied , setCopied ] = useState ( false ) ;
45- const formTitle = useFormBuilderStore . getState ( ) . formTitle . replace ( / \s + / g, "" ) ;
45+ const formTitle = useFormBuilderStore
46+ . getState ( )
47+ . formTitle . replace ( / \s + / g, "" ) ;
4648
4749 useEffect ( ( ) => {
4850 prettier
@@ -79,67 +81,78 @@ export function GenerateCodeDialog({
7981
8082 return (
8183 < Dialog open = { open } onOpenChange = { onOpenChange } >
82- < DialogContent className = "md:max-w-4xl h-[80vh]" >
84+ < DialogContent className = "md:max-w-4xl h-[95vh] xl:h-[ 80vh] max-h-[1024px ]" >
8385 < DialogHeader >
8486 < DialogTitle > Generated Form Code</ DialogTitle >
8587 </ DialogHeader >
86- < div >
87- < h2 className = "text-lg font-semibold mb-0" >
88- 1. Required shadcn/ui components:
89- </ h2 >
90- < h3 className = "text-sm text-muted-foreground" >
91- Run the following commands to add the required components:
92- </ h3 >
93- </ div >
94- < div className = "relative overflow-x-auto rounded-md" >
95- < Pre language = "bash" code = { installationInstructions } />
96- < Button
97- variant = "ghost"
98- size = "sm"
99- className = "absolute top-2 right-2 text-muted-foreground"
100- onClick = { ( ) => handleCopy ( installationInstructions ) }
101- >
102- { copied ? (
103- < Check className = "h-4 w-4" />
104- ) : (
105- < Copy className = "h-4 w-4" />
106- ) }
107- </ Button >
108- </ div >
109- < div >
110- < h2 className = "text-lg font-semibold mb-0" > 2. React Code</ h2 >
111- < h3 className = "text-sm text-muted-foreground" >
112- Copy and paste the following code into your project or < a href = "#" onClick = { handleDownload } className = "underline font-bold" > download the file</ a > .
113- </ h3 >
114- </ div >
115- < div className = "relative overflow-auto rounded-md" >
116- < Pre language = "typescript" code = { formattedCode } />
117- < Button
118- variant = "ghost"
119- size = "sm"
120- className = "absolute top-2 right-2 text-muted-foreground"
121- onClick = { ( ) => handleCopy ( formattedCode ) }
122- >
123- { copied ? (
124- < Check className = "h-4 w-4" />
125- ) : (
126- < Copy className = "h-4 w-4" />
127- ) }
128- </ Button >
129- </ div >
130- < div >
131- < h2 className = "text-lg font-semibold mb-0" > 3. Usage</ h2 >
132- < h3 className = "text-sm text-muted-foreground" >
133- Import the form component and use it in your project.
134- </ h3 >
135- </ div >
136- < div className = "relative overflow-auto rounded-md" >
137- < Pre
138- language = "typescript"
139- code = { `import ${ formTitle } from "./${ formTitle } ";
88+ < div className = "min-h-[500px] w-full overflow-y-auto flex flex-col gap-4" >
89+ < div >
90+ < h2 className = "text-lg font-semibold mb-0" >
91+ 1. Required shadcn/ui components:
92+ </ h2 >
93+ < h3 className = "text-sm text-muted-foreground" >
94+ Run the following commands to add the required components:
95+ </ h3 >
96+ </ div >
97+ < div className = "relative overflow-x-auto rounded-md min-h-20" >
98+ < Pre language = "bash" code = { installationInstructions } />
99+ < Button
100+ variant = "ghost"
101+ size = "sm"
102+ className = "absolute top-2 right-2 text-muted-foreground"
103+ onClick = { ( ) => handleCopy ( installationInstructions ) }
104+ >
105+ { copied ? (
106+ < Check className = "h-4 w-4" />
107+ ) : (
108+ < Copy className = "h-4 w-4" />
109+ ) }
110+ </ Button >
111+ </ div >
112+ < div >
113+ < h2 className = "text-lg font-semibold mb-0" > 2. React Code</ h2 >
114+ < h3 className = "text-sm text-muted-foreground" >
115+ Copy and paste the following code into your project or{ " " }
116+ < a
117+ href = "#"
118+ onClick = { handleDownload }
119+ className = "underline font-bold"
120+ >
121+ download the file
122+ </ a >
123+ .
124+ </ h3 >
125+ </ div >
126+ < div className = "relative overflow-auto rounded-md min-h-20" >
127+ < Pre language = "typescript" code = { formattedCode } />
128+ < Button
129+ variant = "ghost"
130+ size = "sm"
131+ className = "absolute top-2 right-2 text-muted-foreground"
132+ onClick = { ( ) => handleCopy ( formattedCode ) }
133+ >
134+ { copied ? (
135+ < Check className = "h-4 w-4" />
136+ ) : (
137+ < Copy className = "h-4 w-4" />
138+ ) }
139+ </ Button >
140+ </ div >
141+ < div >
142+ < h2 className = "text-lg font-semibold mb-0" > 3. Usage</ h2 >
143+ < h3 className = "text-sm text-muted-foreground" >
144+ Import the form component and use it in your project.
145+ </ h3 >
146+ </ div >
147+ < div className = "relative overflow-auto rounded-md min-h-20" >
148+ < Pre
149+ language = "typescript"
150+ code = { `import ${ formTitle } from "./${ formTitle } ";
140151<${ formTitle } />` }
141- />
152+ />
153+ </ div >
142154 </ div >
155+
143156 < DialogFooter >
144157 < Button variant = "outline" onClick = { ( ) => onOpenChange ( false ) } >
145158 Close
0 commit comments