feat: generate Numbers

This commit is contained in:
Ibrahima G. Coulibaly
2024-06-27 18:39:55 +01:00
parent d75043d282
commit c15dbe94ae
4 changed files with 107 additions and 29 deletions

View File

@@ -5,15 +5,17 @@ export default function ToolInputAndResult({
input,
result
}: {
input: ReactNode;
input?: ReactNode;
result: ReactNode;
}) {
return (
<Grid id="tool" container spacing={2}>
<Grid item xs={12} md={6}>
{input}
</Grid>
<Grid item xs={12} md={6}>
{input && (
<Grid item xs={12} md={6}>
{input}
</Grid>
)}
<Grid item xs={12} md={input ? 6 : 12}>
{result}
</Grid>
</Grid>

View File

@@ -20,7 +20,7 @@ const FormikListenerComponent = <T,>({
useEffect(() => {
try {
if (values && input) compute(values, input);
compute(values, input);
} catch (exception: unknown) {
if (exception instanceof Error) showSnackBar(exception.message, 'error');
}
@@ -41,7 +41,7 @@ export default function ToolOptions<T extends FormikValues>({
initialValues: T;
validationSchema: any | (() => any);
compute: (optionsValues: T, input: any) => void;
input: any;
input?: any;
getGroups: (formikProps: FormikProps<T>) => ToolOptionGroup[];
formRef?: RefObject<FormikProps<T>>;
}) {