feat: arithmetic sequence

This commit is contained in:
Ibrahima G. Coulibaly
2025-03-08 07:32:20 +00:00
parent f678c76200
commit a4895d6721
11 changed files with 249 additions and 48 deletions

View File

@@ -14,10 +14,10 @@ import { GetGroupsType } from '@components/options/ToolOptions';
export interface ExampleCardProps<T> {
title: string;
description: string;
sampleText: string;
sampleText?: string;
sampleResult: string;
sampleOptions: T;
changeInputResult: (newInput: string, newOptions: T) => void;
changeInputResult: (newInput: string | undefined, newOptions: T) => void;
getGroups: GetGroupsType<T> | null;
}

View File

@@ -15,7 +15,7 @@ export interface ExampleProps<T> {
exampleCards: CardExampleType<T>[];
getGroups: GetGroupsType<T> | null;
formRef: React.RefObject<FormikProps<T>>;
setInput: React.Dispatch<React.SetStateAction<any>>;
setInput?: React.Dispatch<React.SetStateAction<any>>;
}
export default function ToolExamples<T>({
@@ -26,8 +26,8 @@ export default function ToolExamples<T>({
formRef,
setInput
}: ExampleProps<T>) {
function changeInputResult(newInput: string, newOptions: T) {
setInput(newInput);
function changeInputResult(newInput: string | undefined, newOptions: T) {
setInput?.(newInput);
formRef.current?.setValues(newOptions);
const toolsElement = document.getElementById('tool');
if (toolsElement) {