#5131 -Event Type Settings Inconsistency (#5147)

* Reusable component

* Fix limits not being toggleable

* Remove custom input margin

* addTestId

* Limits+adv

* Reccuring Tab

* Remove console .log

Co-authored-by: Omar López <[email protected]>
This commit is contained in:
sean-brydonandOmar López authored and GitHub committed 2022-10-24 17:11:07 -06:00
1 parent 5305f31266
commit b18eabc6e8
8 files changed
+401 -482

No files matched your search

+1
View File
@@ -23,6 +23,7 @@
"react": "^18.2.0",
"react-colorful": "^5.6.0",
"react-feather": "^2.0.10",
"@formkit/auto-animate": "^1.0.0-beta.1",
"react-hook-form": "^7.34.2",
"react-icons": "^4.4.0",
"react-select": "^5.4.0"
+57
View File
@@ -0,0 +1,57 @@
import { useAutoAnimate } from "@formkit/auto-animate/react";
import React, { ReactNode } from "react";
import Switch from "./Switch";
import { Label } from "./form";
type Props = {
children?: ReactNode;
title: string;
description?: string;
checked: boolean;
disabled?: boolean;
onCheckedChange?: (checked: boolean) => void;
"data-testid"?: string;
};
function SettingsToggle({
checked,
onCheckedChange,
description,
title,
children,
disabled,
...rest
}: Props) {
const [animateRef] = useAutoAnimate<HTMLDivElement>();
return (
<>
<div className="flex w-full flex-col space-y-4 lg:flex-row lg:space-y-0 lg:space-x-4">
<fieldset className="block w-full flex-col sm:flex">
<div className="flex space-x-3">
<Switch
data-testid={rest["data-testid"]}
fitToHeight={true}
checked={checked}
onCheckedChange={onCheckedChange}
disabled={disabled}
/>
<div className="">
<Label className="text-sm font-semibold leading-none text-black">{title}</Label>
{description && <p className="-mt-2 text-sm leading-normal text-gray-600">{description}</p>}
</div>
</div>
{children && (
<div className="mt-4 lg:ml-14" ref={animateRef}>
{checked && children}
</div>
)}
</fieldset>
</div>
</>
);
}
export default SettingsToggle;
+1
View File
@@ -31,3 +31,4 @@ export { default as HorizontalTabs, HorizontalTabItem } from "./navigation/tabs/
export type { VerticalTabItemProps } from "./navigation/tabs/VerticalTabItem";
export type { HorizontalTabItemProps } from "./navigation/tabs/HorizontalTabItem";
export * from "./Portal";
export { default as SettingsToggle } from "./SettingsToggle";
@@ -15,7 +15,7 @@ type Props = {
function CustomInputItem({ required, deleteOnClick, editOnClick, type, question }: Props) {
const { t } = useLocale();
return (
<li className="border-1 flex border border-gray-200 bg-white px-6 py-4 first:rounded-t-md last:rounded-b-md only:rounded-md xl:ml-7 ">
<li className="border-1 flex border border-gray-200 bg-white px-6 py-4 first:rounded-t-md last:rounded-b-md only:rounded-md">
<div className="flex flex-col">
<div className="flex items-center">
<span className="pr-2 text-sm font-semibold leading-none text-black">{question}</span>