.
This commit is contained in:
@@ -14,14 +14,7 @@ import {
|
||||
DialogHeader,
|
||||
DialogTitle,
|
||||
} from "../ui/dialog";
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "../ui/form";
|
||||
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from "../ui/form";
|
||||
import { IconUploadField } from "../ui/icon-upload-field";
|
||||
import { Input } from "../ui/input";
|
||||
|
||||
@@ -64,34 +57,20 @@ export default function CreateServerModal() {
|
||||
<DialogContent className="sm:max-w-md">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Create server</DialogTitle>
|
||||
<DialogDescription>
|
||||
Give your server a name and choose a server icon.
|
||||
</DialogDescription>
|
||||
<DialogDescription>Give your server a name and choose a server icon.</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<Form {...form}>
|
||||
<form
|
||||
onSubmit={form.handleSubmit(onSubmit)}
|
||||
className="space-y-4"
|
||||
>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="icon"
|
||||
render={({ field, fieldState }) => (
|
||||
<FormItem>
|
||||
<FormLabel
|
||||
required={
|
||||
!schema.shape.icon.isOptional()
|
||||
}
|
||||
>
|
||||
Icon
|
||||
</FormLabel>
|
||||
<FormLabel required={!schema.shape.icon.isOptional()}>Icon</FormLabel>
|
||||
<FormControl>
|
||||
<div className="flex flex-col items-center justify-center">
|
||||
<IconUploadField
|
||||
field={field}
|
||||
error={fieldState.error}
|
||||
/>
|
||||
<IconUploadField field={field} error={fieldState.error} />
|
||||
</div>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
@@ -103,13 +82,7 @@ export default function CreateServerModal() {
|
||||
name="name"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel
|
||||
required={
|
||||
!schema.shape.name.isOptional()
|
||||
}
|
||||
>
|
||||
Name
|
||||
</FormLabel>
|
||||
<FormLabel required={!schema.shape.name.isOptional()}>Name</FormLabel>
|
||||
<FormControl>
|
||||
<Input {...field} />
|
||||
</FormControl>
|
||||
@@ -123,13 +96,8 @@ export default function CreateServerModal() {
|
||||
Close
|
||||
</Button>
|
||||
</DialogClose>
|
||||
<Button
|
||||
type="submit"
|
||||
disabled={form.formState.isSubmitting}
|
||||
>
|
||||
{form.formState.isSubmitting
|
||||
? "Creating..."
|
||||
: "Create"}
|
||||
<Button type="submit" disabled={form.formState.isSubmitting}>
|
||||
{form.formState.isSubmitting ? "Creating..." : "Create"}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user