39 lines
972 B
TypeScript
39 lines
972 B
TypeScript
import { useFormikContext } from 'formik';
|
|
import React from 'react';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { GoArrowSwitch } from 'react-icons/go';
|
|
import { useObjectToEdit } from '../../zustand/ObjectToEditState';
|
|
|
|
const Header = () => {
|
|
const [t] = useTranslation();
|
|
const { values, setFieldValue,setValues } = useFormikContext<any>();
|
|
const {isBseQuestion,set_isBseQuestion} = useObjectToEdit()
|
|
|
|
const handleChange = () => {
|
|
|
|
if (isBseQuestion) {
|
|
set_isBseQuestion(false)
|
|
setValues(null)
|
|
|
|
} else {
|
|
|
|
set_isBseQuestion(true)
|
|
setValues(null)
|
|
}
|
|
};
|
|
|
|
return (
|
|
<header className="exercise_add_header mb-4">
|
|
<div>
|
|
{t("practical.add")} {t("models.exercise")}{" "}
|
|
</div>
|
|
<div>
|
|
<GoArrowSwitch onClick={handleChange} className="m-2" />
|
|
{isBseQuestion ? t("header.malty_exercise") :t("header.exercise") }
|
|
</div>
|
|
</header>
|
|
);
|
|
};
|
|
|
|
export default Header;
|