-
-
+ <>
+
+ ChartDB - Database Schema Templates
+
-
- Tags
-
- {tags ? (
-
({
- title: currentTag,
- href: `/templates/tags/${currentTag}`,
- selected: tag === currentTag,
- }))}
+
+
-
+
+
+
+
+
+ Database Schema Templates
+
+
+ Explore a collection of real-world database schemas
+ drawn from real-world live applications and open-source
+ projects. Use these as a foundation or source of
+ inspiration when designing your app’s architecture.
+
+ {!templates ? (
+
+ ) : (
+
+
+
+
+
+ Tags
+
+ {tags ? (
+ ({
+ title: currentTag,
+ href: `/templates/tags/${currentTag}`,
+ selected: tag === currentTag,
+ }))}
+ />
+ ) : null}
+
+
+ {templates.map((template) => (
+
+ ))}
+
+
+ )}
+
+
+ >
);
};
diff --git a/src/router.tsx b/src/router.tsx
index b631a858..ae87e03f 100644
--- a/src/router.tsx
+++ b/src/router.tsx
@@ -1,6 +1,7 @@
import React from 'react';
import type { RouteObject } from 'react-router-dom';
import { createBrowserRouter } from 'react-router-dom';
+import type { TemplatePageLoaderData } from './pages/template-page/template-page';
const routes: RouteObject[] = [
...['', 'diagrams/:diagramId'].map((path) => ({
@@ -63,6 +64,7 @@ const routes: RouteObject[] = [
},
},
{
+ id: 'templates_templateSlug',
path: 'templates/:templateSlug',
async lazy() {
const { TemplatePage } = await import(
@@ -72,6 +74,16 @@ const routes: RouteObject[] = [
element:
,
};
},
+ loader: async ({ params }): Promise
=> {
+ const { templates } = await import(
+ './templates-data/templates-data'
+ );
+ return {
+ template: templates.find(
+ (template) => template.slug === params.templateSlug
+ ),
+ };
+ },
},
{
path: '*',