Files
omni-tools/src/components/examples/Examples.tsx

52 lines
1.5 KiB
TypeScript
Raw Normal View History

import { Box, Grid, Stack, Typography } from '@mui/material';
2025-02-27 01:47:44 +00:00
import ExampleCard, { ExampleCardProps } from './ExampleCard';
2025-02-27 01:26:48 +00:00
import React from 'react';
import { GetGroupsType } from '@components/options/ToolOptions';
2025-02-27 01:26:48 +00:00
interface ExampleProps<T> {
title: string;
subtitle: string;
2025-02-27 01:47:44 +00:00
exampleCards: Omit<ExampleCardProps<T>, 'getGroups' | 'changeInputResult'>[];
2025-02-27 01:26:48 +00:00
getGroups: GetGroupsType<T>;
2025-02-27 01:47:44 +00:00
changeInputResult: (newOptions: T) => void;
}
2025-02-27 01:26:48 +00:00
export default function Examples<T>({
title,
subtitle,
2025-02-27 01:26:48 +00:00
exampleCards,
getGroups,
changeInputResult
}: ExampleProps<T>) {
return (
2024-06-25 08:39:29 +01:00
<Box id={'examples'} mt={4}>
<Box mt={4} display="flex" gap={1} alignItems="center">
<Typography mb={2} fontSize={30} color={'primary'}>
{title}
</Typography>
<Typography mb={2} fontSize={30} color={'secondary'}>
{subtitle}
</Typography>
</Box>
<Stack direction={'row'} alignItems={'center'} spacing={2}>
<Grid container spacing={2}>
2024-06-24 21:00:42 -07:00
{exampleCards.map((card, index) => (
2024-06-26 00:49:26 +01:00
<Grid item xs={12} md={6} lg={4} key={index}>
<ExampleCard
title={card.title}
description={card.description}
sampleText={card.sampleText}
sampleResult={card.sampleResult}
2025-02-27 01:47:44 +00:00
sampleOptions={card.sampleOptions}
2025-02-27 01:26:48 +00:00
getGroups={getGroups}
changeInputResult={changeInputResult}
/>
</Grid>
))}
</Grid>
</Stack>
</Box>
);
}