Proyectos de Subversion LeadersLinked - SPA

Rev

Rev 3113 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 3113 Rev 3121
Línea 1... Línea 1...
1
import React from 'react'
1
import React from 'react'
2
import { useForm } from 'react-hook-form'
2
import { useForm } from 'react-hook-form'
Línea 3... Línea -...
3
 
-
 
4
import { useHabits } from '@hooks'
-
 
5
 
3
 
6
import Modal from '@components/UI/modal/Modal'
4
import Modal from '@components/UI/modal/Modal'
7
import Input from '@components/UI/inputs/Input'
5
import Input from '@components/UI/inputs/Input'
8
import Select from '@components/UI/inputs/Select'
6
import Select from '@components/UI/inputs/Select'
Línea 44... Línea 42...
44
    value: 'yearly',
42
    value: 'yearly',
45
    name: 'Anualmente'
43
    name: 'Anualmente'
46
  }
44
  }
47
]
45
]
Línea 48... Línea 46...
48
 
46
 
49
export default function HabitsModal() {
-
 
50
  const { toggleModal, showModal, addHabit } = useHabits({ url: '' })
-
 
51
 
47
export default function HabitsModal({ show, onConfirm, onClose }) {
52
  const {
48
  const {
53
    control,
49
    control,
54
    formState: { errors },
50
    formState: { errors },
55
    handleSubmit
51
    handleSubmit
Línea 61... Línea 57...
61
      value: 1,
57
      value: 1,
62
      intelligence: ''
58
      intelligence: ''
63
    }
59
    }
64
  })
60
  })
Línea 65... Línea 61...
65
 
61
 
Línea 66... Línea 62...
66
  const onSubmit = handleSubmit(({ habit }) => addHabit(habit))
62
  const onSubmit = handleSubmit(({ habit }) => onConfirm(habit))
67
 
-
 
68
  return (
-
 
69
    <Modal
-
 
70
      show={showModal}
-
 
71
      title='Propósito'
63
 
72
      onClose={toggleModal}
-
 
73
      onAccept={onSubmit}
64
  return (
74
    >
65
    <Modal show={show} title='Propósito' onClose={onClose} onAccept={onSubmit}>
75
      <Input
66
      <Input
76
        name='title'
67
        name='title'
77
        label='Titulo'
68
        label='Titulo'