added Edit Components#1
This commit is contained in:
11
src/AlbumEdit.tsx
Normal file
11
src/AlbumEdit.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { Edit, ReferenceInput, SimpleForm, TextInput } from 'react-admin';
|
||||||
|
|
||||||
|
export const AlbumEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<ReferenceInput source="userId" reference="users" />
|
||||||
|
<TextInput source="id" />
|
||||||
|
<TextInput source="title" />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
15
src/App.tsx
15
src/App.tsx
@@ -8,37 +8,42 @@ import {
|
|||||||
import { Layout } from "./Layout";
|
import { Layout } from "./Layout";
|
||||||
import { dataProvider } from "./dataProvider";
|
import { dataProvider } from "./dataProvider";
|
||||||
import {UserList} from "./users.tsx";
|
import {UserList} from "./users.tsx";
|
||||||
|
import {UserEdit} from "./UserEdit.tsx";
|
||||||
|
import {PostEdit} from "./PostEdit.tsx";
|
||||||
|
import {CommentEdit} from "./CommentEdit.tsx";
|
||||||
|
import {AlbumEdit} from "./AlbumEdit.tsx";
|
||||||
|
import {PhotoEdit} from "./PhotoEdit.tsx"
|
||||||
|
|
||||||
export const App = () => (
|
export const App = () => (
|
||||||
<Admin layout={Layout} dataProvider={dataProvider}>
|
<Admin layout={Layout} dataProvider={dataProvider}>
|
||||||
<Resource
|
<Resource
|
||||||
name="users"
|
name="users"
|
||||||
list={UserList}
|
list={UserList}
|
||||||
edit={EditGuesser}
|
edit={UserEdit}
|
||||||
show={ShowGuesser}
|
show={ShowGuesser}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="posts"
|
name="posts"
|
||||||
list={ListGuesser}
|
list={ListGuesser}
|
||||||
edit={EditGuesser}
|
edit={PostEdit}
|
||||||
show={ShowGuesser}
|
show={ShowGuesser}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="comments"
|
name="comments"
|
||||||
list={ListGuesser}
|
list={ListGuesser}
|
||||||
edit={EditGuesser}
|
edit={CommentEdit}
|
||||||
show={ShowGuesser}
|
show={ShowGuesser}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="albums"
|
name="albums"
|
||||||
list={ListGuesser}
|
list={ListGuesser}
|
||||||
edit={EditGuesser}
|
edit={AlbumEdit}
|
||||||
show={ShowGuesser}
|
show={ShowGuesser}
|
||||||
/>
|
/>
|
||||||
<Resource
|
<Resource
|
||||||
name="photos"
|
name="photos"
|
||||||
list={ListGuesser}
|
list={ListGuesser}
|
||||||
edit={EditGuesser}
|
edit={PhotoEdit}
|
||||||
show={ShowGuesser}
|
show={ShowGuesser}
|
||||||
/>
|
/>
|
||||||
</Admin>
|
</Admin>
|
||||||
|
|||||||
14
src/CommentEdit.tsx
Normal file
14
src/CommentEdit.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
import { Edit, ReferenceInput, SimpleForm, TextInput } from 'react-admin';
|
||||||
|
|
||||||
|
export const CommentEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<ReferenceInput source="postId" reference="posts" />
|
||||||
|
<TextInput source="id" />
|
||||||
|
<TextInput source="name" />
|
||||||
|
<TextInput source="email" />
|
||||||
|
<TextInput source="body" />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
14
src/PhotoEdit.tsx
Normal file
14
src/PhotoEdit.tsx
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
import { Edit, ReferenceInput, SimpleForm, TextInput } from 'react-admin';
|
||||||
|
|
||||||
|
export const PhotoEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<ReferenceInput source="albumId" reference="albums" />
|
||||||
|
<TextInput source="id" />
|
||||||
|
<TextInput source="title" />
|
||||||
|
<TextInput source="url" />
|
||||||
|
<TextInput source="thumbnailUrl" />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
13
src/PostEdit.tsx
Normal file
13
src/PostEdit.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
|
||||||
|
import { Edit, ReferenceInput, SimpleForm, TextInput } from 'react-admin';
|
||||||
|
|
||||||
|
export const PostEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<ReferenceInput source="userId" reference="users" />
|
||||||
|
<TextInput source="id" />
|
||||||
|
<TextInput source="title" />
|
||||||
|
<TextInput source="body" />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
16
src/UserEdit.tsx
Normal file
16
src/UserEdit.tsx
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import { Edit, SimpleForm, TextInput } from 'react-admin';
|
||||||
|
|
||||||
|
export const UserEdit = () => (
|
||||||
|
<Edit>
|
||||||
|
<SimpleForm>
|
||||||
|
<TextInput source="id" />
|
||||||
|
<TextInput source="name" />
|
||||||
|
<TextInput source="username" />
|
||||||
|
<TextInput source="email" />
|
||||||
|
<TextInput source="address.street" />
|
||||||
|
<TextInput source="phone" />
|
||||||
|
<TextInput source="website" />
|
||||||
|
<TextInput source="company.name" />
|
||||||
|
</SimpleForm>
|
||||||
|
</Edit>
|
||||||
|
);
|
||||||
Reference in New Issue
Block a user