mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-12-17 17:56:38 +00:00
chore: checkbox used instead of switch
This commit is contained in:
parent
6ad57674ea
commit
009a0dd6ad
@ -1,4 +1,4 @@
|
|||||||
import { Box, FormControlLabel, Switch } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import ToolContent from '@components/ToolContent';
|
import ToolContent from '@components/ToolContent';
|
||||||
import { ToolComponentProps } from '@tools/defineTool';
|
import { ToolComponentProps } from '@tools/defineTool';
|
||||||
@ -9,6 +9,7 @@ import { CardExampleType } from '@components/examples/ToolExamples';
|
|||||||
import { unicode } from './service';
|
import { unicode } from './service';
|
||||||
import { InitialValuesType } from './types';
|
import { InitialValuesType } from './types';
|
||||||
import SimpleRadio from '@components/options/SimpleRadio';
|
import SimpleRadio from '@components/options/SimpleRadio';
|
||||||
|
import CheckboxWithDesc from '@components/options/CheckboxWithDesc';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
const initialValues: InitialValuesType = {
|
const initialValues: InitialValuesType = {
|
||||||
@ -51,17 +52,13 @@ const exampleCards: CardExampleType<InitialValuesType>[] = [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
export default function Unicode({
|
export default function Unicode({ title }: ToolComponentProps) {
|
||||||
title,
|
|
||||||
longDescription
|
|
||||||
}: ToolComponentProps) {
|
|
||||||
const { t } = useTranslation('string');
|
const { t } = useTranslation('string');
|
||||||
const [input, setInput] = useState<string>('');
|
const [input, setInput] = useState<string>('');
|
||||||
const [result, setResult] = useState<string>('');
|
const [result, setResult] = useState<string>('');
|
||||||
|
|
||||||
const compute = (values: InitialValuesType, input: string) => {
|
const compute = (values: InitialValuesType, input: string) => {
|
||||||
if (!input) return;
|
setResult(unicode(input, values));
|
||||||
setResult(unicode(input, values.mode === 'encode', values.uppercase));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const getGroups: GetGroupsType<InitialValuesType> = ({
|
const getGroups: GetGroupsType<InitialValuesType> = ({
|
||||||
@ -89,15 +86,10 @@ export default function Unicode({
|
|||||||
title: t('unicode.caseOptionsTitle'),
|
title: t('unicode.caseOptionsTitle'),
|
||||||
component: (
|
component: (
|
||||||
<Box>
|
<Box>
|
||||||
<FormControlLabel
|
<CheckboxWithDesc
|
||||||
control={
|
checked={values.uppercase}
|
||||||
<Switch
|
onChange={(value) => updateField('uppercase', value)}
|
||||||
checked={values.uppercase}
|
title={t('unicode.uppercase')}
|
||||||
onChange={(e) => updateField('uppercase', e.target.checked)}
|
|
||||||
disabled={values.mode === 'decode'}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={t('unicode.uppercase')}
|
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user