From 31ba4c04c8f26409c702302b52c5ad12090d6d07 Mon Sep 17 00:00:00 2001 From: Salih Date: Wed, 16 Jun 2021 11:19:05 +0300 Subject: [PATCH 1/4] fix example code --- examples/useModalForm/public/index.html | 2 +- examples/useModalForm/public/manifest.json | 4 ++-- .../useModalForm/src/interfaces/index.d.ts | 8 ------- .../useModalForm/src/pages/posts/list.tsx | 21 +++++++------------ 4 files changed, 10 insertions(+), 25 deletions(-) diff --git a/examples/useModalForm/public/index.html b/examples/useModalForm/public/index.html index 8b678faa61ec..d433c81b0739 100644 --- a/examples/useModalForm/public/index.html +++ b/examples/useModalForm/public/index.html @@ -24,7 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - refine useModalForm Example App + refine useModalForm example app diff --git a/examples/useModalForm/public/manifest.json b/examples/useModalForm/public/manifest.json index 935e5548542c..6c2e973641a2 100644 --- a/examples/useModalForm/public/manifest.json +++ b/examples/useModalForm/public/manifest.json @@ -1,6 +1,6 @@ { - "short_name": "refine useModalForm Example App", - "name": "refine useModalForm Example App", + "short_name": "refine useModalForm example app", + "name": "refine useModalForm example app", "icons": [ { "src": "favicon.ico", diff --git a/examples/useModalForm/src/interfaces/index.d.ts b/examples/useModalForm/src/interfaces/index.d.ts index 3c805f2d5919..504316aa6ed6 100644 --- a/examples/useModalForm/src/interfaces/index.d.ts +++ b/examples/useModalForm/src/interfaces/index.d.ts @@ -1,12 +1,4 @@ -export interface ICategory { - id: string; - title: string; -} - export interface IPost { id: string; title: string; - content: string; - status: "published" | "draft" | "rejected"; - category: ICategory; } diff --git a/examples/useModalForm/src/pages/posts/list.tsx b/examples/useModalForm/src/pages/posts/list.tsx index 9172ac8d1a26..9f568c17ebe5 100644 --- a/examples/useModalForm/src/pages/posts/list.tsx +++ b/examples/useModalForm/src/pages/posts/list.tsx @@ -11,12 +11,11 @@ import { Modal, Space, Typography, - MarkdownField, + EditButton, + ShowButton, useTable, useShow, useModalForm, - EditButton, - ShowButton, IResourceComponentsProps, } from "@pankod/refine"; @@ -24,7 +23,7 @@ import { IPost } from "interfaces"; const { Title, Text } = Typography; -export const PostList: React.FC = (props) => { +export const PostList: React.FC = () => { const { tableProps } = useTable(); // Create Modal @@ -68,14 +67,14 @@ export const PostList: React.FC = (props) => { }, }} > - - - +
+ + title="Actions" dataIndex="actions" key="actions" - render={(_value, record) => ( + render={(_, record) => ( = (props) => { width={1000} > = (props) => { Title {record?.title} - - Content - From 9f3f90c029cb6e01c00b9c25f5bc748f857215fc Mon Sep 17 00:00:00 2001 From: Salih Date: Wed, 16 Jun 2021 11:46:11 +0300 Subject: [PATCH 2/4] add codesandbox embed code to doc --- .../docs/guides-and-concepts/hooks/useModalForm.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/documentation/docs/guides-and-concepts/hooks/useModalForm.md b/documentation/docs/guides-and-concepts/hooks/useModalForm.md index e1969fd9d311..c371231697c6 100644 --- a/documentation/docs/guides-and-concepts/hooks/useModalForm.md +++ b/documentation/docs/guides-and-concepts/hooks/useModalForm.md @@ -248,3 +248,12 @@ Don't forget to pass the record id to `show` to fetch the record data. This is n | mutationResult | Result of the mutation triggered by submitting the form | [`UseMutationResult<`
`{ data: TData },`
`TError,`
` { resource: string; values: TVariables; },`
` unknown>`](https://react-query.tanstack.com/reference/useMutation) | | setCloneId | `cloneId` setter | `Dispatch>` | | cloneId | Record id for clone action | `string` | + +## Live Codesandbox Example + + \ No newline at end of file From 2cd28721920d34204a65fbc5dabfb5834c66df50 Mon Sep 17 00:00:00 2001 From: Salih Date: Wed, 16 Jun 2021 12:23:51 +0300 Subject: [PATCH 3/4] add mising interface prop, and fix order form item --- .../useModalForm/src/interfaces/index.d.ts | 1 + .../useModalForm/src/pages/posts/list.tsx | 47 ++++++++++--------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/examples/useModalForm/src/interfaces/index.d.ts b/examples/useModalForm/src/interfaces/index.d.ts index 504316aa6ed6..3c5b760b9a1b 100644 --- a/examples/useModalForm/src/interfaces/index.d.ts +++ b/examples/useModalForm/src/interfaces/index.d.ts @@ -1,4 +1,5 @@ export interface IPost { id: string; title: string; + status: "published" | "draft" | "rejected"; } diff --git a/examples/useModalForm/src/pages/posts/list.tsx b/examples/useModalForm/src/pages/posts/list.tsx index 9f568c17ebe5..eb01a6c9fb45 100644 --- a/examples/useModalForm/src/pages/posts/list.tsx +++ b/examples/useModalForm/src/pages/posts/list.tsx @@ -102,17 +102,6 @@ export const PostList: React.FC = () => { }} >
- - - = () => { ]} /> + + + @@ -155,17 +155,6 @@ export const PostList: React.FC = () => { }} >
- - - = () => { ]} /> + + + @@ -210,6 +210,9 @@ export const PostList: React.FC = () => { Id {record?.id} + Status + {record?.status} + Title {record?.title} From 741ca896659c98fd39f60d91db71555211251391 Mon Sep 17 00:00:00 2001 From: Salih Date: Wed, 16 Jun 2021 12:27:37 +0300 Subject: [PATCH 4/4] update codesandbox link --- documentation/docs/guides-and-concepts/hooks/useModalForm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/documentation/docs/guides-and-concepts/hooks/useModalForm.md b/documentation/docs/guides-and-concepts/hooks/useModalForm.md index c371231697c6..df9fd9956717 100644 --- a/documentation/docs/guides-and-concepts/hooks/useModalForm.md +++ b/documentation/docs/guides-and-concepts/hooks/useModalForm.md @@ -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 - \ No newline at end of file + >