refactor: replace SimpleRadio with CheckboxWithDesc for boolean options

This commit is contained in:
EugSh
2025-03-11 08:17:50 +03:00
parent 19bdc5a53c
commit 3b4af2f2fb

View File

@@ -10,6 +10,7 @@ import ToolContent from '@components/ToolContent';
import { CardExampleType } from '@components/examples/ToolExamples'; import { CardExampleType } from '@components/examples/ToolExamples';
import { ToolComponentProps } from '@tools/defineTool'; import { ToolComponentProps } from '@tools/defineTool';
import SimpleRadio from '@components/options/SimpleRadio'; import SimpleRadio from '@components/options/SimpleRadio';
import CheckboxWithDesc from '@components/options/CheckboxWithDesc';
const exampleCards: CardExampleType<InitialValuesType>[] = [ const exampleCards: CardExampleType<InitialValuesType>[] = [
{ {
@@ -107,8 +108,8 @@ export default function Truncate({ title }: ToolComponentProps) {
onOwnChange={(val) => updateField('maxLength', val)} onOwnChange={(val) => updateField('maxLength', val)}
type={'number'} type={'number'}
/> />
<SimpleRadio <CheckboxWithDesc
onClick={() => updateField('lineByLine', !values.lineByLine)} onChange={(val) => updateField('lineByLine', val)}
checked={values.lineByLine} checked={values.lineByLine}
title={'Line-by-line Truncating'} title={'Line-by-line Truncating'}
description={'Truncate each line separately.'} description={'Truncate each line separately.'}
@@ -120,10 +121,11 @@ export default function Truncate({ title }: ToolComponentProps) {
title: 'Suffix and Affix', title: 'Suffix and Affix',
component: ( component: (
<Box> <Box>
<SimpleRadio <CheckboxWithDesc
onClick={() => updateField('addIndicator', !values.addIndicator)} onChange={(val) => updateField('addIndicator', val)}
checked={values.addIndicator} checked={values.addIndicator}
title={'Add Truncation Indicator'} title={'Add Truncation Indicator'}
description={''}
/> />
<TextFieldWithDesc <TextFieldWithDesc
description={ description={