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

62 lines
1.7 KiB
TypeScript
Raw Normal View History

import { Box, Grid, Stack, Typography } from '@mui/material';
import ExampleCard 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
export interface ExampleCardProps<T> {
title: string;
description: string;
sampleText: string;
sampleResult: string;
2025-02-27 01:26:48 +00:00
requiredOptions: T;
2024-06-24 21:00:42 -07:00
changeInputResult: (input: string, result: string) => void;
2025-02-27 01:26:48 +00:00
getGroups: GetGroupsType<T>;
}
2025-02-27 01:26:48 +00:00
interface ExampleProps<T> {
title: string;
subtitle: string;
2025-02-27 01:26:48 +00:00
exampleCards: ExampleCardProps<T>[];
getGroups: GetGroupsType<T>;
changeInputResult: (input: string, result: string) => 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}
requiredOptions={card.requiredOptions}
2025-02-27 01:26:48 +00:00
getGroups={getGroups}
changeInputResult={changeInputResult}
/>
</Grid>
))}
</Grid>
</Stack>
</Box>
);
}