fix(web): TS typings and always active navbar link (#470)

* fix TS typings since `yarn build` was failing on my machine.
* fixed the dashboard navlink (it was always active on my end)
This commit is contained in:
stacksmash76 2022-09-23 19:03:00 +02:00 committed by GitHub
parent 8a782a5cab
commit 553320bf1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 60 additions and 35 deletions

View file

@ -4,6 +4,7 @@ import { classNames, get } from "../../utils";
import { useToggle } from "../../hooks/hooks";
import { EyeIcon, EyeSlashIcon } from "@heroicons/react/24/solid";
import { ErrorMessage } from "@hookform/error-message";
import type { FieldValues } from "react-hook-form";
export type FormErrorMessageProps = {
className?: string;
@ -81,7 +82,7 @@ export const Input: FC<InputProps> = forwardRef<HTMLInputElement, InputProps>(
export type FormInputProps<TFormValues> = {
name: Path<TFormValues>;
rules?: RegisterOptions;
register?: UseFormRegister<TFormValues>;
register?: UseFormRegister<TFormValues & FieldValues>;
errors?: Partial<DeepMap<TFormValues, FieldError>>;
} & Omit<InputProps, "name">;

View file

@ -1,26 +1,27 @@
import React, {Fragment, useRef} from "react";
import {XMarkIcon} from "@heroicons/react/24/solid";
import {Dialog, Transition} from "@headlessui/react";
import {Form, Formik} from "formik";
import React, { Fragment, useRef } from "react";
import { XMarkIcon } from "@heroicons/react/24/solid";
import { Dialog, Transition } from "@headlessui/react";
import { Form, Formik } from "formik";
import type { FormikValues } from "formik";
import DEBUG from "../debug";
import {useToggle} from "../../hooks/hooks";
import {DeleteModal} from "../modals";
import {classNames} from "../../utils";
import { useToggle } from "../../hooks/hooks";
import { DeleteModal } from "../modals";
import { classNames } from "../../utils";
interface SlideOverProps<DataType> {
title: string;
initialValues: DataType;
validate?: (values: DataType) => void;
onSubmit: (values?: DataType) => void;
isOpen: boolean;
toggle: () => void;
children?: (values: DataType) => React.ReactNode;
deleteAction?: () => void;
type: "CREATE" | "UPDATE";
testFn?: (data: unknown) => void;
isTesting?: boolean;
isTestSuccessful?: boolean;
isTestError?: boolean;
title: string;
initialValues: FormikValues & DataType;
validate?: (values: DataType) => void;
onSubmit: (values?: DataType) => void;
isOpen: boolean;
toggle: () => void;
children?: (values: DataType) => React.ReactNode;
deleteAction?: () => void;
type: "CREATE" | "UPDATE";
testFn?: (data: unknown) => void;
isTesting?: boolean;
isTestSuccessful?: boolean;
isTestError?: boolean;
}
function SlideOver<DataType>({
@ -81,7 +82,7 @@ function SlideOver<DataType>({
onSubmit={onSubmit}
validate={validate}
>
{({ handleSubmit, values }) => (
{({ handleSubmit, values }) => (
<Form className="h-full flex flex-col bg-white dark:bg-gray-800 shadow-xl overflow-y-scroll"
onSubmit={handleSubmit}>