From afa0d9c0b781ae847caa151ea2bbe33a912335d1 Mon Sep 17 00:00:00 2001 From: Dev-CasperTheGhost <53900565+Dev-CasperTheGhost@users.noreply.github.com> Date: Sat, 15 Apr 2023 15:00:03 +0200 Subject: [PATCH] feat: updated switch field --- .../values/manage-modal/LicenseFields.tsx | 20 +++--- .../business/CreateBusinessModal.tsx | 19 +++--- .../employees-tab/manage-employee-modal.tsx | 61 +++++++++---------- 3 files changed, 45 insertions(+), 55 deletions(-) diff --git a/apps/client/src/components/admin/values/manage-modal/LicenseFields.tsx b/apps/client/src/components/admin/values/manage-modal/LicenseFields.tsx index 8611d13b3..caaccf00a 100644 --- a/apps/client/src/components/admin/values/manage-modal/LicenseFields.tsx +++ b/apps/client/src/components/admin/values/manage-modal/LicenseFields.tsx @@ -1,7 +1,5 @@ import { ValueLicenseType } from "@snailycad/types"; -import { SelectField } from "@snailycad/ui"; -import { FormField } from "components/form/FormField"; -import { Toggle } from "components/form/Toggle"; +import { SelectField, SwitchField } from "@snailycad/ui"; import { useFormikContext } from "formik"; export const LICENSE_LABELS = { @@ -16,7 +14,7 @@ const LICENSE_TYPES = Object.values(ValueLicenseType).map((v) => ({ })); export function LicenseFields() { - const { values, errors, setFieldValue, handleChange } = useFormikContext(); + const { values, errors, setFieldValue } = useFormikContext(); return ( <> @@ -54,13 +52,13 @@ export function LicenseFields() { {!values.licenseType || values.licenseType === ValueLicenseType.LICENSE ? (
- - - + setFieldValue("isDefault", isSelected)} + > + Default License + +

This license will be given to a citizen when they are first created.

diff --git a/apps/client/src/components/business/CreateBusinessModal.tsx b/apps/client/src/components/business/CreateBusinessModal.tsx index cc8afedef..0afa2c0e9 100644 --- a/apps/client/src/components/business/CreateBusinessModal.tsx +++ b/apps/client/src/components/business/CreateBusinessModal.tsx @@ -1,5 +1,4 @@ -import { Loader, Button, TextField } from "@snailycad/ui"; -import { FormField } from "components/form/FormField"; +import { Loader, Button, TextField, SwitchField } from "@snailycad/ui"; import { Modal } from "components/modal/Modal"; import { useModal } from "state/modalState"; import { Form, Formik } from "formik"; @@ -8,7 +7,6 @@ import { ModalIds } from "types/ModalIds"; import { useTranslations } from "use-intl"; import { CREATE_COMPANY_SCHEMA } from "@snailycad/schemas"; import { handleValidate } from "lib/handleValidate"; -import { Toggle } from "components/form/Toggle"; import { useRouter } from "next/router"; import { toastMessage } from "lib/toastMessage"; import { WhitelistStatus } from "@snailycad/types"; @@ -69,7 +67,7 @@ export function CreateBusinessModal({ onCreate }: Props) { onClose={handleClose} > - {({ handleChange, setFieldValue, errors, values, isValid }) => ( + {({ setFieldValue, errors, values, isValid }) => (
- - - + setFieldValue("whitelisted", isSelected)} + > + {t("whitelisted")} +