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>; } export default function ToolExamples({ title, subtitle, exampleCards, getGroups, formRef }: ExampleProps) { function changeInputResult(newOptions: T) { 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) => ( ))} ); }