import React from 'react'; import { Button, Intent, FormGroup, Checkbox } from '@blueprintjs/core'; import { FormattedMessage as T } from 'components'; import { useHistory } from 'react-router-dom'; import classNames from 'classnames'; import { FastField, useFormikContext } from 'formik'; import { CLASSES } from 'common/classes'; import { useItemFormContext } from './ItemFormProvider'; /** * Item form floating actions. */ export default function ItemFormFloatingActions() { // History context. const history = useHistory(); // Item form context. const { setSubmitPayload, isNewMode } = useItemFormContext(); // Formik context. const { isSubmitting } = useFormikContext(); // Handle cancel button click. const handleCancelBtnClick = (event) => { history.goBack(); }; // Handle submit button click. const handleSubmitBtnClick = (event) => { setSubmitPayload({ redirect: true }); }; // Handle submit & new button click. const handleSubmitAndNewBtnClick = (event) => { setSubmitPayload({ redirect: false }); }; return (
{/*----------- Active ----------*/} {({ field }) => ( } name={'active'} {...field} /> )}
); }