mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-09-23 16:09:30 +02:00
feat: Split string
This commit is contained in:
10
src/pages/string/StringConfig.tsx
Normal file
10
src/pages/string/StringConfig.tsx
Normal file
@@ -0,0 +1,10 @@
|
||||
import {RouteObject} from "react-router-dom";
|
||||
import {lazy} from "react";
|
||||
|
||||
const StringHome = lazy(() => import("./index"));
|
||||
const StringSplit = lazy(() => import("./split"));
|
||||
|
||||
export const StringConfig: RouteObject[] = [
|
||||
{path: '', element: <StringHome/>},
|
||||
{path: 'split', element: <StringSplit/>},
|
||||
]
|
5
src/pages/string/index.tsx
Normal file
5
src/pages/string/index.tsx
Normal file
@@ -0,0 +1,5 @@
|
||||
import {Box} from "@mui/material";
|
||||
|
||||
export default function StringHome() {
|
||||
return (<Box></Box>)
|
||||
}
|
45
src/pages/string/split/index.tsx
Normal file
45
src/pages/string/split/index.tsx
Normal file
@@ -0,0 +1,45 @@
|
||||
import ToolHeader from "../../../components/ToolHeader";
|
||||
import ToolLayout from "../../../components/ToolLayout";
|
||||
import {Box, Stack, TextField} from "@mui/material";
|
||||
import Grid from "@mui/material/Grid";
|
||||
import Typography from "@mui/material/Typography";
|
||||
import Button from "@mui/material/Button";
|
||||
import PublishIcon from '@mui/icons-material/Publish';
|
||||
import ContentPasteIcon from '@mui/icons-material/ContentPaste';
|
||||
import DownloadIcon from '@mui/icons-material/Download';
|
||||
import React, {useEffect, useState} from "react";
|
||||
|
||||
export default function SplitText() {
|
||||
const [input, setInput] = useState<string>('');
|
||||
const [result, setResult] = useState<string>('')
|
||||
useEffect(() => {
|
||||
setResult(input.split(' ').join('\n'))
|
||||
}, [input]);
|
||||
return (
|
||||
<ToolLayout>
|
||||
<ToolHeader title={"Text Splitter"}
|
||||
description={"World's simplest browser-based utility for splitting text. Load your text in the input form on the left and you'll automatically get pieces of this text on the right. Powerful, free, and fast. Load text – get chunks."}/>
|
||||
|
||||
<Grid container spacing={2}>
|
||||
<Grid item xs={6}>
|
||||
<Typography fontSize={30} color={'primary'}>Input text</Typography>
|
||||
<TextField value={input} onChange={event => setInput(event.target.value)} fullWidth multiline rows={10}/>
|
||||
<Stack mt={1} direction={'row'} spacing={2}>
|
||||
<Button startIcon={<PublishIcon/>}>Import from file</Button>
|
||||
<Button startIcon={<ContentPasteIcon/>}>Copy to clipboard</Button>
|
||||
</Stack>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<Typography fontSize={30} color={'primary'}>Text pieces</Typography>
|
||||
<TextField value={result} fullWidth multiline rows={10}/>
|
||||
<Stack mt={1} direction={'row'} spacing={2}>
|
||||
<Button startIcon={<DownloadIcon/>}>Save as</Button>
|
||||
<Button startIcon={<ContentPasteIcon/>}>Copy to clipboard</Button>
|
||||
</Stack>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Box mt={2}>
|
||||
|
||||
</Box>
|
||||
</ToolLayout>)
|
||||
}
|
Reference in New Issue
Block a user