-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
=
committed
Sep 3, 2024
1 parent
ddf1f1e
commit beb280f
Showing
3 changed files
with
72 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { Meta } from "@storybook/react"; | ||
import { useForm } from "react-hook-form"; | ||
import { Button, FormBuilder } from "../../index"; | ||
|
||
const meta = { | ||
title: "Form/DateOnBuilder", | ||
component: FormBuilder.FormFields, | ||
} satisfies Meta<typeof FormBuilder.FormFields>; | ||
|
||
export default meta; | ||
|
||
export const DateOnBuilder = () => { | ||
const form = useForm({ | ||
values: { | ||
date: null, | ||
}, | ||
}); | ||
|
||
return ( | ||
<form | ||
onSubmit={form.handleSubmit((data) => { | ||
console.log(data); | ||
})} | ||
> | ||
<FormBuilder.Root> | ||
<FormBuilder.FormFields | ||
control={form.control} | ||
fields={[ | ||
{ | ||
name: "date", | ||
type: "date", | ||
label: "Date", | ||
required: true, | ||
size: 6, | ||
}, | ||
]} | ||
/> | ||
</FormBuilder.Root> | ||
<Button type="submit">Submeter</Button> | ||
</form> | ||
); | ||
}; |