ChannelCreate.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import { ProForm, ProFormText, ProFormSelect } from "@ant-design/pro-components";
  2. import { useIntl } from "react-intl";
  3. import { message } from "antd";
  4. interface IFormData {
  5. name: string;
  6. type: string;
  7. }
  8. type IWidgetChannelCreate = {
  9. studio: string | undefined;
  10. };
  11. const Widget = (param: IWidgetChannelCreate) => {
  12. const intl = useIntl();
  13. return (
  14. <ProForm<IFormData>
  15. onFinish={async (values: IFormData) => {
  16. // TODO
  17. console.log(values);
  18. message.success(intl.formatMessage({ id: "flashes.success" }));
  19. }}
  20. >
  21. <ProForm.Group>
  22. <ProFormText
  23. width="md"
  24. name="name"
  25. required
  26. label={intl.formatMessage({ id: "channel.name" })}
  27. rules={[
  28. {
  29. required: true,
  30. message: intl.formatMessage({ id: "channel.create.message.noname" }),
  31. },
  32. ]}
  33. />
  34. </ProForm.Group>
  35. <ProForm.Group>
  36. <ProFormSelect
  37. options={[
  38. {
  39. value: "translation",
  40. label: intl.formatMessage({ id: "channel.type.translation.title" }),
  41. },
  42. {
  43. value: "nissaya",
  44. label: intl.formatMessage({ id: "channel.type.nissaya.title" }),
  45. },
  46. ]}
  47. width="md"
  48. name="type"
  49. label={intl.formatMessage({ id: "channel.type" })}
  50. />
  51. </ProForm.Group>
  52. </ProForm>
  53. );
  54. };
  55. export default Widget;