Files
Web-Frontend/client/src/components/Canvas/views/Account.jsx
T

76 lines
2.0 KiB
React
Raw Normal View History

2025-08-04 16:02:06 -07:00
import { Box, Flex, Field, Input, Stack, Heading, Button } from "@chakra-ui/react"
import { useForm } from 'react-hook-form';
2025-08-04 12:20:26 -07:00
export default function AccountCanvas() {
2025-08-04 16:02:06 -07:00
const {
register,
handleSubmit,
watch,
formState: { errors },
} = useForm();
const onSubmit = (data) => {
console.log("Form submitted:", data);
}
console.log(watch("example")); // watch input value by passing the name of it
return (
2025-08-04 12:20:26 -07:00
<Flex
height="100vh"
direction="column"
align="start"
justify="start"
bg="gray.50"
pt={6}
pl={6}
>
<Heading as="h1" mb={2}>Account</Heading>
<Box
2025-08-04 16:02:06 -07:00
as="form"
onSubmit={handleSubmit(onSubmit)}
2025-08-04 12:20:26 -07:00
border="1px solid"
borderColor="gray.300"
borderRadius="md"
2025-08-04 12:20:26 -07:00
padding={4}
bg="white"
boxShadow="md"
width="100%"
maxW="sm"
>
2025-08-04 12:20:26 -07:00
{/* <Text fontSize="xl" fontWeight="bold" mb={6}>
Account
</Text> */}
<Stack gap="6" maxW="sm" css={{ "--field-label-width": "96px" }}>
<Field.Root orientation="horizontal">
<Field.Label>User Name</Field.Label>
2025-08-04 16:02:06 -07:00
<Input {...register("username")} placeholder="David Johnston" flex="1" />
2025-08-04 12:20:26 -07:00
</Field.Root>
<Field.Root orientation="horizontal">
<Field.Label> First Name</Field.Label>
2025-08-04 16:02:06 -07:00
<Input {...register("firstname")} placeholder="David" flex="1" />
2025-08-04 12:20:26 -07:00
</Field.Root>
<Field.Root orientation="horizontal">
<Field.Label>Last Name</Field.Label>
2025-08-04 16:02:06 -07:00
<Input {...register("lastname")} placeholder="Johnston" flex="1" />
2025-08-04 12:20:26 -07:00
</Field.Root>
<Field.Root orientation="horizontal">
<Field.Label>Email</Field.Label>
2025-08-04 16:02:06 -07:00
<Input {...register("email")} placeholder="djohntson@usgs.gov" flex="1" />
2025-08-04 12:20:26 -07:00
</Field.Root>
2025-08-04 16:02:06 -07:00
<Button type="submit">
Save
</Button>
2025-08-04 12:20:26 -07:00
</Stack>
</Box>
2025-08-04 12:20:26 -07:00
</Flex>
)
}