diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 60f7ebb..7cda4f1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,9 +4,13 @@
-
+
-
+
+
+
+
+
@@ -333,15 +337,7 @@
-
-
-
-
- 1740321721526
-
-
-
- 1740321721526
+
@@ -727,7 +723,15 @@
1741483603658
-
+
+
+ 1741483792562
+
+
+
+ 1741483792562
+
+
@@ -786,7 +790,6 @@
-
@@ -811,7 +814,8 @@
-
+
+
diff --git a/src/components/examples/ExampleCard.tsx b/src/components/examples/ExampleCard.tsx
index f4b1bf0..c16295c 100644
--- a/src/components/examples/ExampleCard.tsx
+++ b/src/components/examples/ExampleCard.tsx
@@ -60,33 +60,36 @@ export default function ExampleCard({
{description}
-
-
-
+ >
+
+
+ )}
{
compute: (optionsValues: T, input: any) => void;
input: any;
children?: ReactNode;
- getGroups: (
- formikProps: FormikProps & { updateField: UpdateField }
- ) => ToolOptionGroup[];
+ getGroups:
+ | null
+ | ((
+ formikProps: FormikProps & { updateField: UpdateField }
+ ) => ToolOptionGroup[]);
formikProps: FormikProps;
}
@@ -63,7 +65,9 @@ const ToolBody = ({
input={input}
initialValues={values}
/>
-
+
{children}
);
@@ -90,41 +94,41 @@ export default function ToolOptions({
formRef?: RefObject>;
}) {
const theme = useTheme();
- if (getGroups)
- return (
-
-
-
- Tool options
-
-
- {}}
- >
- {(formikProps) => (
-
- {children}
-
- )}
-
-
+ return (
+
+
+
+ Tool options
+
+
+ {}}
+ >
+ {(formikProps) => (
+
+ {children}
+
+ )}
+
- );
+
+ );
}
diff --git a/src/pages/tools/string/randomize-case/index.tsx b/src/pages/tools/string/randomize-case/index.tsx
index 1c7a149..f34621f 100644
--- a/src/pages/tools/string/randomize-case/index.tsx
+++ b/src/pages/tools/string/randomize-case/index.tsx
@@ -1,15 +1,10 @@
-import { Box } from '@mui/material';
-import React, { useState, useRef } from 'react';
+import React, { useState } from 'react';
import ToolTextInput from '@components/input/ToolTextInput';
import ToolTextResult from '@components/result/ToolTextResult';
-import ToolOptions from '@components/options/ToolOptions';
import { randomizeCase } from './service';
-import ToolInputAndResult from '@components/ToolInputAndResult';
-import ToolExamples, {
- CardExampleType
-} from '@components/examples/ToolExamples';
+import { CardExampleType } from '@components/examples/ToolExamples';
import { ToolComponentProps } from '@tools/defineTool';
-import { FormikProps } from 'formik';
+import ToolContent from '@components/ToolContent';
const initialValues = {};
@@ -45,7 +40,6 @@ const exampleCards: CardExampleType[] = [
export default function RandomizeCase({ title }: ToolComponentProps) {
const [input, setInput] = useState('');
const [result, setResult] = useState('');
- const formRef = useRef>(null);
const computeExternal = (
_optionsValues: typeof initialValues,
@@ -54,27 +48,19 @@ export default function RandomizeCase({ title }: ToolComponentProps) {
setResult(randomizeCase(input));
};
- const getGroups = () => [];
-
return (
-
- }
- result={}
- />
-
-
-
+ }
+ resultComponent={
+
+ }
+ exampleCards={exampleCards}
+ />
);
}
diff --git a/src/pages/tools/string/reverse/index.tsx b/src/pages/tools/string/reverse/index.tsx
index 83c3872..b017b79 100644
--- a/src/pages/tools/string/reverse/index.tsx
+++ b/src/pages/tools/string/reverse/index.tsx
@@ -11,6 +11,7 @@ import ToolExamples, {
} from '@components/examples/ToolExamples';
import { ToolComponentProps } from '@tools/defineTool';
import { FormikProps } from 'formik';
+import ToolContent from '@components/ToolContent';
const initialValues = {
multiLine: true,
@@ -59,7 +60,6 @@ const exampleCards: CardExampleType[] = [
export default function Reverse({ title }: ToolComponentProps) {
const [input, setInput] = useState('');
const [result, setResult] = useState('');
- const formRef = useRef>(null);
const computeExternal = (
optionsValues: typeof initialValues,
@@ -102,24 +102,18 @@ export default function Reverse({ title }: ToolComponentProps) {
];
return (
-
- }
- result={}
- />
-
-
-
+ }
+ resultComponent={
+
+ }
+ exampleCards={exampleCards}
+ />
);
}
diff --git a/src/pages/tools/string/uppercase/index.tsx b/src/pages/tools/string/uppercase/index.tsx
index 305c4d7..e234cda 100644
--- a/src/pages/tools/string/uppercase/index.tsx
+++ b/src/pages/tools/string/uppercase/index.tsx
@@ -1,15 +1,10 @@
-import { Box } from '@mui/material';
-import React, { useState, useRef } from 'react';
+import React, { useState } from 'react';
import ToolTextInput from '@components/input/ToolTextInput';
import ToolTextResult from '@components/result/ToolTextResult';
-import ToolOptions from '@components/options/ToolOptions';
import { UppercaseInput } from './service';
-import ToolInputAndResult from '@components/ToolInputAndResult';
-import ToolExamples, {
- CardExampleType
-} from '@components/examples/ToolExamples';
+import { CardExampleType } from '@components/examples/ToolExamples';
import { ToolComponentProps } from '@tools/defineTool';
-import { FormikProps } from 'formik';
+import ToolContent from '@components/ToolContent';
const initialValues = {};
@@ -42,7 +37,6 @@ const exampleCards: CardExampleType[] = [
export default function Uppercase({ title }: ToolComponentProps) {
const [input, setInput] = useState('');
const [result, setResult] = useState('');
- const formRef = useRef>(null);
const computeExternal = (
_optionsValues: typeof initialValues,
@@ -51,27 +45,19 @@ export default function Uppercase({ title }: ToolComponentProps) {
setResult(UppercaseInput(input));
};
- const getGroups = () => [];
-
return (
-
- }
- result={}
- />
-
-
-
+ }
+ resultComponent={
+
+ }
+ exampleCards={exampleCards}
+ />
);
}