49 lines
977 B
TypeScript
49 lines
977 B
TypeScript
|
|
import { Col, Row } from 'reactstrap';
|
|
import ValidationField from '../../../../Components/ValidationField/ValidationField';
|
|
import { useFormikContext } from 'formik';
|
|
import { Switch } from 'antd';
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
function Form() {
|
|
const { values,setFieldValue } = useFormikContext<any>();
|
|
const [t] = useTranslation()
|
|
const onChange = (checked: boolean) => {
|
|
console.log(`switch to ${checked}`);
|
|
|
|
setFieldValue("is_active", checked ? 1 : 0)
|
|
|
|
};
|
|
|
|
|
|
return (
|
|
<Row xs={1} sm={1} md={1} lg={2} xl={2}>
|
|
<Col>
|
|
|
|
<ValidationField name="image" type='File' />
|
|
|
|
</Col>
|
|
<Col>
|
|
<div className="ValidationField w-100" >
|
|
<label className="text">
|
|
{t(`is_active`)}
|
|
</label>
|
|
</div>
|
|
|
|
<Switch title='is_active' defaultValue={values?.is_active} size='default' style={{width:"50px"}} onChange={onChange} />
|
|
|
|
</Col>
|
|
|
|
|
|
|
|
|
|
</Row>
|
|
)
|
|
}
|
|
|
|
export default Form
|
|
|
|
|
|
|
|
|