added title in add aboutus

This commit is contained in:
Philip Cheung 2024-10-07 20:07:54 +08:00
parent be06a0783f
commit dadc2cec38
1 changed files with 20 additions and 4 deletions

View File

@ -16,6 +16,7 @@ import {
NumberInputStepper, NumberInputStepper,
NumberIncrementStepper, NumberIncrementStepper,
NumberDecrementStepper, NumberDecrementStepper,
Input,
} from "@chakra-ui/react" } from "@chakra-ui/react"
import { useMutation, useQueryClient } from "@tanstack/react-query" import { useMutation, useQueryClient } from "@tanstack/react-query"
@ -82,6 +83,7 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => {
criteriaMode: "all", criteriaMode: "all",
defaultValues: { defaultValues: {
index: 0, index: 0,
title: "",
description: "", description: "",
image: undefined, image: undefined,
}, },
@ -149,6 +151,20 @@ const AddAboutUs = ({ isOpen, onClose }: AddAboutUsProps) => {
<ModalCloseButton /> <ModalCloseButton />
<ModalBody pb={30}> <ModalBody pb={30}>
<FormControl isRequired isInvalid={!!errors.title}>
<FormLabel htmlFor="title">Title</FormLabel>
<Input
id="title"
{...register("title", {
required: "Title is required.",
})}
placeholder="Title"
type="text"
/>
{errors.title && (
<FormErrorMessage>{errors.title.message}</FormErrorMessage>
)}
</FormControl>
<FormControl isRequired isInvalid={!!errors.description}> <FormControl isRequired isInvalid={!!errors.description}>
<Editor <Editor
editorState={editorState} editorState={editorState}