Formulario.jsx 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. import { Form, Input, Button, Row, Col } from 'antd'
  2. import PropTypes from 'prop-types'
  3. // const selectores = {
  4. // consejoElectoral: {
  5. // name: "v1/consejo-electoral",
  6. // },
  7. // }
  8. const Formulario = ({
  9. form,
  10. onFinish,
  11. botones = []
  12. }) => {
  13. return (
  14. <Form
  15. layout="vertical"
  16. name="basic"
  17. form={form}
  18. initialValues={{ remember: true }}
  19. onFinish={onFinish}
  20. onFinishFailed={() => { }}
  21. >
  22. <Row gutter={16}>
  23. <Col span={12}>
  24. <Row gutter={10}>
  25. <Col span={12}>
  26. <Form.Item
  27. // label="Búsqueda"
  28. name="q"
  29. >
  30. <Input />
  31. </Form.Item>
  32. </Col>
  33. <Col span={4}>
  34. <Form.Item>
  35. <Button
  36. type="primary"
  37. htmlType="submit"
  38. // style={{ marginTop: "30px" }}
  39. block
  40. >
  41. Buscar
  42. </Button>
  43. </Form.Item>
  44. </Col>
  45. </Row>
  46. </Col>
  47. <Col span={12}>
  48. <Row gutter={10} justify={'end'}>
  49. {botones.map((i, index) => (
  50. <Col>
  51. {
  52. Boolean(i?.text) ? (
  53. <Button
  54. key={`btnGroup-${index}`}
  55. onClick={i.onClick}
  56. {...i.props}
  57. >
  58. {i.icon} {i.text}
  59. </Button>
  60. ) : (
  61. <Button
  62. key={`btnGroup-${index}`}
  63. onClick={i.onClick}
  64. icon={i.icon}
  65. {...i.props}
  66. />
  67. )
  68. }
  69. </Col>
  70. ))}
  71. </Row>
  72. </Col>
  73. </Row>
  74. </Form>
  75. )
  76. }
  77. export default Formulario
  78. Formulario.propTypes = {
  79. form: PropTypes.object.isRequired,
  80. onFinish: PropTypes.func.isRequired,
  81. }