Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix useModalForm Example v2 #620

Merged
merged 5 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix example code
  • Loading branch information
salihozdemir committed Jun 16, 2021
commit 31ba4c04c8f26409c702302b52c5ad12090d6d07
2 changes: 1 addition & 1 deletion examples/useModalForm/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
-->
<title>refine useModalForm Example App</title>
<title>refine useModalForm example app</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
Expand Down
4 changes: 2 additions & 2 deletions examples/useModalForm/public/manifest.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
8 changes: 0 additions & 8 deletions examples/useModalForm/src/interfaces/index.d.ts
Original file line number Diff line number Diff line change
@@ -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;
}
21 changes: 7 additions & 14 deletions examples/useModalForm/src/pages/posts/list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@ import {
Modal,
Space,
Typography,
MarkdownField,
EditButton,
ShowButton,
useTable,
useShow,
useModalForm,
EditButton,
ShowButton,
IResourceComponentsProps,
} from "@pankod/refine";

import { IPost } from "interfaces";

const { Title, Text } = Typography;

export const PostList: React.FC<IResourceComponentsProps> = (props) => {
export const PostList: React.FC<IResourceComponentsProps> = () => {
const { tableProps } = useTable<IPost>();

// Create Modal
Expand Down Expand Up @@ -68,14 +67,14 @@ export const PostList: React.FC<IResourceComponentsProps> = (props) => {
},
}}
>
<Table {...tableProps} key="id">
<Table.Column key="id" dataIndex="id" title="ID" />
<Table.Column key="title" dataIndex="title" title="Title" />
<Table {...tableProps} rowKey="id">
<Table.Column dataIndex="id" title="ID" />
<Table.Column dataIndex="title" title="Title" />
<Table.Column<IPost>
title="Actions"
dataIndex="actions"
key="actions"
render={(_value, record) => (
render={(_, record) => (
<Space>
<EditButton
size="small"
Expand Down Expand Up @@ -202,7 +201,6 @@ export const PostList: React.FC<IResourceComponentsProps> = (props) => {
width={1000}
>
<Show
{...props}
isLoading={showIsLoading}
recordItemId={showId}
pageHeaderProps={{
Expand All @@ -214,11 +212,6 @@ export const PostList: React.FC<IResourceComponentsProps> = (props) => {

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

<Title level={5}>Content</Title>
<MarkdownField
value={record?.content ?? "Cannot found content"}
/>
</Show>
</Modal>
</>
Expand Down