import Link from "next/link";
import { useState } from "react";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import { connect } from "react-redux";
import { Field, reduxForm } from "redux-form";
const required = (errorMsg) => (value) =>
value || typeof value === "number" ? undefined : errorMsg;
export const minLength = (errorMsg) => (value) =>
value && value.length < 4
? errorMsg //`Must be ${min} characters or more`
: undefined;
const RenderTextfield = ({
id,
className,
rows,
datafieldname,
name,
label,
input,
hint1,
hint2,
hint3,
meta: { touched, error },
...custom
}) => {
return (
<>
>
);
};
let CaseSearch = (props) => {
let { t } = useTranslation();
const { handleSubmit, pristine, reset, submitting } = props;
const router = useRouter();
const { locale } = router;
//const [showSpinnerState, setShowSpinnerState] = useState(false);
// let spinnerState = () => {
// showSpinnerState == true
// ? setShowSpinnerState(false)
// : setShowSpinnerState(true);
// };
const onHandleSubmit = (values) => {
//spinnerState();
router.push({
pathname:
router.locale == "cy"
? "/fymhorth/canlyniadauchwilio"
: "/myportal/searchresults",
query: { q: values.basicSearch },
shallow: true,
});
};
return <>
>;
};
const mapStateToProps = (state) => {
return {
currentView: state.currentView,
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
//form: state.form,
myCases: state.myCases,
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
};
};
const mapDispatchToProps = (dispatch) => {
return {};
};
export default connect(
mapStateToProps,
mapDispatchToProps
)(
reduxForm({
form: "basicSearchForm",
destroyOnUnmount: false,
})(CaseSearch)
);