feat: tools normalized

This commit is contained in:
Ibrahima G. Coulibaly
2024-06-22 22:06:16 +01:00
parent 17ba68be34
commit 23f50ffead
36 changed files with 2625 additions and 1045 deletions

39
src/tools/defineTool.tsx Normal file
View File

@@ -0,0 +1,39 @@
import ToolLayout from '../components/ToolLayout';
import React, { LazyExoticComponent, JSXElementConstructor } from 'react';
interface ToolOptions {
path: string;
component: LazyExoticComponent<JSXElementConstructor<NonNullable<unknown>>>;
keywords: string[];
name: string;
description: string;
}
interface DefinedTool {
path: string;
name: string;
description: string;
keywords: string[];
component: () => JSX.Element;
}
export const defineTool = (
basePath: string,
options: ToolOptions
): DefinedTool => {
const { path, name, description, keywords, component } = options;
const Component = component;
return {
path: `${basePath}/${path}`,
name,
description,
keywords,
component: () => {
return (
<ToolLayout title={name} description={description}>
<Component />
</ToolLayout>
);
}
};
};

4
src/tools/index.ts Normal file
View File

@@ -0,0 +1,4 @@
import { stringTools } from '../pages/string/stringTools';
import { imageTools } from '../pages/images/imageTools';
export const tools = [...stringTools, ...imageTools];