import { Box, Grid, Stack, Typography } from '@mui/material'; import ExampleCard, { ExampleCardProps } from './ExampleCard'; import React from 'react'; import { GetGroupsType } from '@components/options/ToolOptions'; import { FormikProps } from 'formik'; export type CardExampleType = Omit< ExampleCardProps, 'getGroups' | 'changeInputResult' >; export interface ExampleProps { title: string; subtitle?: string; exampleCards: CardExampleType[]; getGroups: GetGroupsType; formRef: React.RefObject>; setInput: React.Dispatch>; } export default function ToolExamples({ title, subtitle, exampleCards, getGroups, formRef, setInput }: ExampleProps) { function changeInputResult(newInput: string, newOptions: T) { setInput(newInput); formRef.current?.setValues(newOptions); const toolsElement = document.getElementById('tool'); if (toolsElement) { toolsElement.scrollIntoView({ behavior: 'smooth' }); } } return ( {`${title} Examples`} {subtitle ?? 'Click to try!'} {exampleCards.map((card, index) => ( ))} ); }