Skip to content

Commit

Permalink
Fix useModalForm Example v2 (refinedev#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
salihozdemir authored Jun 16, 2021
1 parent 79c0ab3 commit 8cc06e3
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
4 changes: 2 additions & 2 deletions documentation/docs/guides-and-concepts/hooks/useModalForm.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,9 @@ Don't forget to pass the record id to `show` to fetch the record data. This is n

## Live Codesandbox Example

<iframe src="https://codesandbox.io/embed/refine-use-modal-form-example-qz7no?autoresize=1&fontsize=14&module=%2Fsrc%2Fpages%2Fposts%2Flist.tsx&theme=dark&view=preview"
<iframe src="https://codesandbox.io/embed/refine-use-modal-form-example-qbi4m?autoresize=1&fontsize=14&module=%2Fsrc%2Fpages%2Fposts%2Flist.tsx&theme=dark&view=preview"
style={{width: "100%", height:"80vh", border: "0px", borderRadius: "8px", overflow:"hidden"}}
title="refine-use-modal-form-example"
allow="accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking"
sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
></iframe>
></iframe>
1 change: 1 addition & 0 deletions examples/useModalForm/src/interfaces/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export interface IPost {
id: string;
title: string;
status: "published" | "draft" | "rejected";
}
47 changes: 25 additions & 22 deletions examples/useModalForm/src/pages/posts/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,6 @@ export const PostList: React.FC<IResourceComponentsProps> = () => {
}}
>
<Form {...createFormProps} layout="vertical">
<Form.Item
label="Title"
name="title"
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
<Form.Item
label="Status"
name="status"
Expand All @@ -139,6 +128,17 @@ export const PostList: React.FC<IResourceComponentsProps> = () => {
]}
/>
</Form.Item>
<Form.Item
label="Title"
name="title"
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
</Form>
</Create>
</Modal>
Expand All @@ -155,17 +155,6 @@ export const PostList: React.FC<IResourceComponentsProps> = () => {
}}
>
<Form {...editFormProps} layout="vertical">
<Form.Item
label="Title"
name="title"
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
<Form.Item
label="Status"
name="status"
Expand All @@ -192,6 +181,17 @@ export const PostList: React.FC<IResourceComponentsProps> = () => {
]}
/>
</Form.Item>
<Form.Item
label="Title"
name="title"
rules={[
{
required: true,
},
]}
>
<Input />
</Form.Item>
</Form>
</Edit>
</Modal>
Expand All @@ -210,6 +210,9 @@ export const PostList: React.FC<IResourceComponentsProps> = () => {
<Title level={5}>Id</Title>
<Text>{record?.id}</Text>

<Title level={5}>Status</Title>
<Text>{record?.status}</Text>

<Title level={5}>Title</Title>
<Text>{record?.title}</Text>
</Show>
Expand Down

0 comments on commit 8cc06e3

Please sign in to comment.