()
| 8 | import type { IPost } from "../../interfaces"; |
| 9 | |
| 10 | export const PostCreate: React.FC = () => { |
| 11 | const [locale, setLocale] = useState("en"); |
| 12 | |
| 13 | const { formProps, saveButtonProps } = useForm<IPost>(); |
| 14 | |
| 15 | const { selectProps } = useSelect({ |
| 16 | resource: "categories", |
| 17 | metaData: { locale }, |
| 18 | }); |
| 19 | |
| 20 | return ( |
| 21 | <Create saveButtonProps={saveButtonProps}> |
| 22 | <Form |
| 23 | {...formProps} |
| 24 | layout="vertical" |
| 25 | onFinish={(values) => { |
| 26 | formProps.onFinish?.(mediaUploadMapper(values)); |
| 27 | }} |
| 28 | > |
| 29 | <Form.Item label="Locale" name="locale"> |
| 30 | <Radio.Group onChange={(e) => setLocale(e.target.value)}> |
| 31 | <Radio.Button value="en">English</Radio.Button> |
| 32 | <Radio.Button value="de">Deutsch</Radio.Button> |
| 33 | </Radio.Group> |
| 34 | </Form.Item> |
| 35 | <Form.Item |
| 36 | label="Title" |
| 37 | name="title" |
| 38 | rules={[ |
| 39 | { |
| 40 | required: true, |
| 41 | }, |
| 42 | ]} |
| 43 | > |
| 44 | <Input /> |
| 45 | </Form.Item> |
| 46 | <Form.Item |
| 47 | label="Category" |
| 48 | name="category" |
| 49 | rules={[ |
| 50 | { |
| 51 | required: true, |
| 52 | }, |
| 53 | ]} |
| 54 | > |
| 55 | <Select {...selectProps} /> |
| 56 | </Form.Item> |
| 57 | <Form.Item |
| 58 | label="Content" |
| 59 | name="content" |
| 60 | rules={[ |
| 61 | { |
| 62 | required: true, |
| 63 | }, |
| 64 | ]} |
| 65 | > |
| 66 | <MDEditor data-color-mode="light" /> |
| 67 | </Form.Item> |
nothing calls this directly
no test coverage detected