PostShow completed #3
This commit is contained in:
12
src/App.tsx
12
src/App.tsx
@@ -14,6 +14,10 @@ import {CommentEdit} from "./Components/CommentEdit.tsx";
|
||||
import {AlbumEdit} from "./Components/AlbumEdit.tsx";
|
||||
import {PhotoEdit} from "./Components/PhotoEdit.tsx";
|
||||
import {MyLayout} from "./Components/MyLayout.tsx";
|
||||
import {UserShow} from "./Components/UserShow.tsx";
|
||||
import {CommentShow} from "./Components/CommentShow.tsx";
|
||||
import {PostShow} from "./Components/PostShow.tsx";
|
||||
import {PostList} from "./Components/PostList.tsx";
|
||||
|
||||
export const App = () => (
|
||||
<Admin layout={MyLayout} dataProvider={dataProvider}>
|
||||
@@ -21,19 +25,19 @@ export const App = () => (
|
||||
name="users"
|
||||
list={UserList}
|
||||
edit={UserEdit}
|
||||
show={ShowGuesser}
|
||||
show={UserShow}
|
||||
/>
|
||||
<Resource
|
||||
name="posts"
|
||||
list={ListGuesser}
|
||||
list={PostList}
|
||||
edit={PostEdit}
|
||||
show={ShowGuesser}
|
||||
show={PostShow}
|
||||
/>
|
||||
<Resource
|
||||
name="comments"
|
||||
list={ListGuesser}
|
||||
edit={CommentEdit}
|
||||
show={ShowGuesser}
|
||||
show={CommentShow}
|
||||
/>
|
||||
<Resource
|
||||
name="albums"
|
||||
|
||||
13
src/Components/CommentShow.tsx
Normal file
13
src/Components/CommentShow.tsx
Normal file
@@ -0,0 +1,13 @@
|
||||
import { EmailField, ReferenceField, Show, SimpleShowLayout, TextField,} from 'react-admin';
|
||||
|
||||
export const CommentShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<ReferenceField source="postId" reference="posts" />
|
||||
<TextField source="id" />
|
||||
<TextField source="name" />
|
||||
<EmailField source="email" />
|
||||
<TextField source="body" />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
12
src/Components/PostList.tsx
Normal file
12
src/Components/PostList.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Datagrid, List, ReferenceField, TextField,} from 'react-admin';
|
||||
|
||||
export const PostList = () => (
|
||||
<List>
|
||||
<Datagrid>
|
||||
<ReferenceField source="userId" reference="users" />
|
||||
<TextField source="id" />
|
||||
<TextField source="title" />
|
||||
<TextField source="body" />
|
||||
</Datagrid>
|
||||
</List>
|
||||
);
|
||||
29
src/Components/PostShow.tsx
Normal file
29
src/Components/PostShow.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
import {
|
||||
ReferenceManyField,
|
||||
Show,
|
||||
TextField,
|
||||
Datagrid,
|
||||
EmailField,
|
||||
SimpleShowLayout,
|
||||
ReferenceField,
|
||||
} from "react-admin";
|
||||
|
||||
export const PostShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<ReferenceField source="userId" reference="users" />
|
||||
<TextField source="id" />
|
||||
<TextField source="title" />
|
||||
<TextField source="body" />
|
||||
<ReferenceManyField target="postId" reference="comments">
|
||||
<Datagrid>
|
||||
<TextField source="postId" />
|
||||
<TextField source="name" />
|
||||
<TextField source="id" />
|
||||
<EmailField source="email" />
|
||||
<TextField source="body" />
|
||||
</Datagrid>
|
||||
</ReferenceManyField>
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
16
src/Components/UserShow.tsx
Normal file
16
src/Components/UserShow.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { EmailField, Show, SimpleShowLayout, TextField } from 'react-admin';
|
||||
|
||||
export const UserShow = () => (
|
||||
<Show>
|
||||
<SimpleShowLayout>
|
||||
<TextField source="id" />
|
||||
<TextField source="name" />
|
||||
<TextField source="username" />
|
||||
<EmailField source="email" />
|
||||
<TextField source="address.street" />
|
||||
<TextField source="phone" />
|
||||
<TextField source="website" />
|
||||
<TextField source="company.name" />
|
||||
</SimpleShowLayout>
|
||||
</Show>
|
||||
);
|
||||
Reference in New Issue
Block a user