Reac front end for psicometric app

four.js 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import * as Yup from 'yup';
  2. // import { useState, useEffect } from 'react';
  3. import { useFormik, Form, FormikProvider } from 'formik';
  4. import {
  5. Box, Button, Stack, TextField,
  6. } from '@mui/material';
  7. export function StepFour(props) {
  8. const PlazaScheme = Yup.object().shape({
  9. puesto: Yup.object().required('Escoge un puesto valido')
  10. });
  11. let { handleNext, handleBack } = props
  12. const formik = useFormik({
  13. initialValues: {
  14. puesto: {}
  15. },
  16. onSubmit: (fields) => {
  17. console.log('SUBMIT > ',fields)
  18. handleNext()
  19. },
  20. validationSchema: PlazaScheme,
  21. });
  22. const { handleSubmit } = formik;
  23. return (
  24. <FormikProvider style={{ padding : 25 }} value={formik}>
  25. <Form autoComplete="off" noValidate onSubmit={handleSubmit}>
  26. <Stack spacing={2}>
  27. <Box
  28. component="form"
  29. sx={{
  30. '& .MuiTextField-root': { m: 1, width: '25ch' },
  31. }}
  32. noValidate
  33. autoComplete="off"
  34. >
  35. <div>
  36. <TextField
  37. required
  38. id="outlined-required"
  39. label="Required"
  40. defaultValue="Hello World"
  41. />
  42. <TextField
  43. disabled
  44. id="outlined-disabled"
  45. label="Disabled"
  46. defaultValue="Hello World"
  47. />
  48. <TextField
  49. id="outlined-password-input"
  50. label="Password"
  51. type="password"
  52. autoComplete="current-password"
  53. />
  54. <TextField
  55. id="outlined-read-only-input"
  56. label="Read Only"
  57. defaultValue="Hello World"
  58. InputProps={{
  59. readOnly: true,
  60. }}
  61. />
  62. <TextField
  63. id="outlined-number"
  64. label="Number"
  65. type="number"
  66. InputLabelProps={{
  67. shrink: true,
  68. }}
  69. />
  70. <TextField id="outlined-search" label="Search field" type="search" />
  71. <TextField
  72. id="outlined-helperText"
  73. label="Helper text"
  74. defaultValue="Default Value"
  75. helperText="Some important text"
  76. />
  77. </div>
  78. </Box>
  79. <Box sx={{ mb: 2 }}>
  80. <div style={{ paddingTop : 15}}>
  81. <Button
  82. type="submit"
  83. className="registerBtn"
  84. variant="contained"
  85. sx={{ mt: 1, mr: 1 }}
  86. >
  87. {'Siguiente'}
  88. </Button>
  89. <Button
  90. disabled={false}
  91. onClick={handleBack}
  92. sx={{ mt: 1, mr: 1 }}
  93. >
  94. Regresar
  95. </Button>
  96. </div>
  97. </Box>
  98. </Stack>
  99. </Form>
  100. </FormikProvider>
  101. );
  102. }