feat: sum numbers init

This commit is contained in:
Ibrahima G. Coulibaly
2024-06-25 03:11:48 +01:00
parent bea0332020
commit cfe0d324fe
17 changed files with 324 additions and 49 deletions

View File

@@ -3,7 +3,7 @@ import { Box, Stack, TextField } from '@mui/material';
import PaletteIcon from '@mui/icons-material/Palette';
import IconButton from '@mui/material/IconButton';
import Typography from '@mui/material/Typography';
import { descriptionFontSize } from '../../config/uiConfig';
import { globalDescriptionFontSize } from '../../config/uiConfig';
interface ColorSelectorProps {
value: string;
@@ -44,7 +44,9 @@ const ColorSelector: React.FC<ColorSelectorProps> = ({
onChange={handleColorChange}
/>
</Stack>
<Typography fontSize={descriptionFontSize}>{description}</Typography>
<Typography fontSize={globalDescriptionFontSize}>
{description}
</Typography>
</Box>
);
};

View File

@@ -4,37 +4,38 @@ import { Field } from 'formik';
import Typography from '@mui/material/Typography';
import React from 'react';
import TextFieldWithDesc from './TextFieldWithDesc';
import { globalDescriptionFontSize } from '../../config/uiConfig';
import SimpleRadio from './SimpleRadio';
const RadioWithTextField = <T,>({
fieldName,
type,
radioValue,
title,
onTypeChange,
onRadioChange,
value,
description,
onTextChange
onTextChange,
typeDescription
}: {
fieldName: string;
title: string;
type: T;
onTypeChange: (val: T) => void;
radioValue: T;
onRadioChange: (val: T) => void;
value: string;
description: string;
onTextChange: (value: string) => void;
typeDescription?: string;
}) => {
const onChange = () => onTypeChange(type);
const onChange = () => onRadioChange(radioValue);
return (
<Box>
<Stack
direction={'row'}
sx={{ mt: 2, mb: 1, cursor: 'pointer' }}
onClick={onChange}
alignItems={'center'}
spacing={1}
>
<Field type="radio" name={fieldName} value={type} onChange={onChange} />
<Typography>{title}</Typography>
</Stack>
<SimpleRadio
value={radioValue}
onChange={onChange}
fieldName={fieldName}
title={title}
description={typeDescription}
/>
<TextFieldWithDesc
value={value}
onChange={onTextChange}

View File

@@ -0,0 +1,46 @@
import { Box, Stack } from '@mui/material';
import { Field } from 'formik';
import Typography from '@mui/material/Typography';
import { globalDescriptionFontSize } from '../../config/uiConfig';
import React from 'react';
interface SimpleRadioProps {
onChange: () => void;
fieldName: string;
value: any;
title: string;
description?: string;
}
export default function SimpleRadio({
onChange,
fieldName,
value,
title,
description
}: SimpleRadioProps) {
return (
<Box>
<Stack
direction={'row'}
sx={{ mt: 2, mb: 1, cursor: 'pointer' }}
onClick={onChange}
alignItems={'center'}
spacing={1}
>
<Field
type="radio"
name={fieldName}
value={value}
onChange={onChange}
/>
<Typography>{title}</Typography>
</Stack>
{description && (
<Typography ml={2} fontSize={globalDescriptionFontSize}>
{description}
</Typography>
)}
</Box>
);
}

View File

@@ -11,7 +11,9 @@ export default function ToolOptionGroups({
<Stack direction={'row'} spacing={2}>
{groups.map((group) => (
<Box key={group.title}>
<Typography fontSize={22}>{group.title}</Typography>
<Typography mb={1} fontSize={22}>
{group.title}
</Typography>
{group.component}
</Box>
))}