diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index ea76cdc..8dc4f22 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,10 @@
-
+
-
-
+
+
@@ -206,15 +206,7 @@
-
-
-
-
- 1719187190823
-
-
-
- 1719187190823
+
@@ -600,7 +592,15 @@
1720565760853
-
+
+
+ 1720656867853
+
+
+
+ 1720656867853
+
+
@@ -644,7 +644,6 @@
-
@@ -669,7 +668,8 @@
-
+
+
diff --git a/src/pages/list/reverse/index.tsx b/src/pages/list/reverse/index.tsx
index 1e40781..100b7bf 100644
--- a/src/pages/list/reverse/index.tsx
+++ b/src/pages/list/reverse/index.tsx
@@ -1,11 +1,110 @@
import { Box } from '@mui/material';
-import React from 'react';
+import React, { useState } from 'react';
+import ToolTextInput from '../../../components/input/ToolTextInput';
+import ToolTextResult from '../../../components/result/ToolTextResult';
import * as Yup from 'yup';
+import ToolOptions from '../../../components/options/ToolOptions';
+import { reverseList, SplitOperatorType } from './service';
+import ToolInputAndResult from '../../../components/ToolInputAndResult';
+import SimpleRadio from '../../../components/options/SimpleRadio';
+import TextFieldWithDesc from '../../../components/options/TextFieldWithDesc';
+
+const initialValues = {
+ splitOperatorType: 'symbol' as SplitOperatorType,
+ splitSeparator: ',',
+ joinSeparator: '\\n'
+};
+const splitOperators: {
+ title: string;
+ description: string;
+ type: SplitOperatorType;
+}[] = [
+ {
+ title: 'Use a Symbol for Splitting',
+ description: 'Delimit input list items with a character.',
+ type: 'symbol'
+ },
+ {
+ title: 'Use a Regex for Splitting',
+ type: 'regex',
+ description: 'Delimit input list items with a regular expression.'
+ }
+];
-const initialValues = {};
-const validationSchema = Yup.object({
- // splitSeparator: Yup.string().required('The separator is required')
-});
export default function Reverse() {
- return Lorem ipsum;
+ const [input, setInput] = useState('');
+ const [result, setResult] = useState('');
+ const compute = (optionsValues: typeof initialValues, input: any) => {
+ const { splitOperatorType, splitSeparator, joinSeparator } = optionsValues;
+
+ setResult(
+ reverseList(splitOperatorType, splitSeparator, joinSeparator, input)
+ );
+ };
+ const validationSchema = Yup.object({
+ // splitSeparator: Yup.string().required('The separator is required')
+ });
+
+ return (
+
+
+ }
+ result={}
+ />
+ [
+ {
+ title: 'Splitter Mode',
+ component: (
+
+ {splitOperators.map(({ title, description, type }) => (
+ updateField('splitOperatorType', type)}
+ title={title}
+ description={description}
+ checked={values.splitOperatorType === type}
+ />
+ ))}
+
+ )
+ },
+ {
+ title: 'Item Separator',
+ component: (
+
+ updateField('splitSeparator', val)}
+ />
+
+ )
+ },
+ {
+ title: 'Output List Options',
+ component: (
+
+ updateField('joinSeparator', val)}
+ />
+
+ )
+ }
+ ]}
+ initialValues={initialValues}
+ input={input}
+ validationSchema={validationSchema}
+ />
+
+ );
}
diff --git a/src/pages/list/reverse/service.ts b/src/pages/list/reverse/service.ts
index cae6cb4..8700435 100644
--- a/src/pages/list/reverse/service.ts
+++ b/src/pages/list/reverse/service.ts
@@ -1,4 +1,4 @@
-type SplitOperatorType = 'symbol' | 'regex';
+export type SplitOperatorType = 'symbol' | 'regex';
export function reverseList(
splitOperatorType: SplitOperatorType,