diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ce2da8c..d664249 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,12 @@
-
+
-
-
+
+
+
+
@@ -202,15 +204,7 @@
-
-
-
-
- 1719090379202
-
-
-
- 1719090379202
+
@@ -596,7 +590,15 @@
1719491470485
-
+
+
+ 1719499895862
+
+
+
+ 1719499895862
+
+
@@ -617,7 +619,6 @@
-
@@ -642,7 +643,8 @@
-
+
+
diff --git a/src/components/ToolInputAndResult.tsx b/src/components/ToolInputAndResult.tsx
index f71ac85..a07721f 100644
--- a/src/components/ToolInputAndResult.tsx
+++ b/src/components/ToolInputAndResult.tsx
@@ -5,15 +5,17 @@ export default function ToolInputAndResult({
input,
result
}: {
- input: ReactNode;
+ input?: ReactNode;
result: ReactNode;
}) {
return (
-
- {input}
-
-
+ {input && (
+
+ {input}
+
+ )}
+
{result}
diff --git a/src/components/options/ToolOptions.tsx b/src/components/options/ToolOptions.tsx
index 351ccec..89baf83 100644
--- a/src/components/options/ToolOptions.tsx
+++ b/src/components/options/ToolOptions.tsx
@@ -20,7 +20,7 @@ const FormikListenerComponent = ({
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({
initialValues: T;
validationSchema: any | (() => any);
compute: (optionsValues: T, input: any) => void;
- input: any;
+ input?: any;
getGroups: (formikProps: FormikProps) => ToolOptionGroup[];
formRef?: RefObject>;
}) {
diff --git a/src/pages/number/generate/index.tsx b/src/pages/number/generate/index.tsx
index 2943432..e810407 100644
--- a/src/pages/number/generate/index.tsx
+++ b/src/pages/number/generate/index.tsx
@@ -1,11 +1,85 @@
import { Box } from '@mui/material';
-import React from 'react';
+import React, { useState } from 'react';
+import ToolTextResult from '../../../components/result/ToolTextResult';
import * as Yup from 'yup';
+import ToolOptions from '../../../components/options/ToolOptions';
+import { listOfIntegers } from './service';
+import ToolInputAndResult from '../../../components/ToolInputAndResult';
+import TextFieldWithDesc from '../../../components/options/TextFieldWithDesc';
-const initialValues = {};
-const validationSchema = Yup.object({
- // splitSeparator: Yup.string().required('The separator is required')
-});
-export default function Generate() {
- return Lorem ipsum;
+const initialValues = {
+ firstValue: '1',
+ numberOfNumbers: '10',
+ step: '1',
+ separator: '\\n'
+};
+export default function SplitText() {
+ const [result, setResult] = useState('');
+
+ const validationSchema = Yup.object({
+ // splitSeparator: Yup.string().required('The separator is required')
+ });
+
+ return (
+
+ }
+ />
+ [
+ {
+ title: 'Arithmetic sequence option',
+ component: (
+
+ setFieldValue('firstValue', val)}
+ type={'number'}
+ />
+ setFieldValue('step', val)}
+ type={'number'}
+ />
+ setFieldValue('numberOfNumbers', val)}
+ type={'number'}
+ />
+
+ )
+ },
+ {
+ title: 'Separator',
+ component: (
+ setFieldValue('separator', val)}
+ />
+ )
+ }
+ ]}
+ compute={(optionsValues) => {
+ const { firstValue, numberOfNumbers, separator, step } =
+ optionsValues;
+ setResult(
+ listOfIntegers(
+ Number(firstValue),
+ Number(numberOfNumbers),
+ Number(step),
+ separator
+ )
+ );
+ }}
+ initialValues={initialValues}
+ validationSchema={validationSchema}
+ />
+
+ );
}