From ef99e9b2a098b2ec514cefce97cfad2b395cf83e Mon Sep 17 00:00:00 2001 From: francesco Date: Tue, 3 Aug 2021 11:55:09 +0200 Subject: [PATCH] Updated home page cards --- .../custom_schema_view/BlogEntryPreview.tsx | 60 +++++++++++++++++++ src/core/internal/HomeRoute.tsx | 54 ++++++++--------- 2 files changed, 87 insertions(+), 27 deletions(-) create mode 100644 example/src/SampleApp/custom_schema_view/BlogEntryPreview.tsx diff --git a/example/src/SampleApp/custom_schema_view/BlogEntryPreview.tsx b/example/src/SampleApp/custom_schema_view/BlogEntryPreview.tsx new file mode 100644 index 0000000..2f5724a --- /dev/null +++ b/example/src/SampleApp/custom_schema_view/BlogEntryPreview.tsx @@ -0,0 +1,60 @@ +import React from "react"; +import { Box, Button } from "@material-ui/core"; +import { Entity, EntityValues, useSnackbarController } from "@camberi/firecms"; +import { blogSchema } from "../schemas/blog_schema"; + +export function SampleProductsView({ entity, modifiedValues }: { + entity?: Entity; + modifiedValues?: EntityValues; +}) { + + const snackbarContext = useSnackbarController(); + + const onClick = (event: React.MouseEvent) => { + snackbarContext.open({ + type: "success", + message: `Custom action for ${modifiedValues?.name}` + }); + }; + + return ( + + + + + +

+ This is an example of a custom view added + as a panel to an entity schema. +

+

+ Values in the form: +

+

+ {modifiedValues && JSON.stringify(modifiedValues, null, 2)} +

+
+ + + +
+
+ ); + +} diff --git a/src/core/internal/HomeRoute.tsx b/src/core/internal/HomeRoute.tsx index 4951b0b..81b4da9 100644 --- a/src/core/internal/HomeRoute.tsx +++ b/src/core/internal/HomeRoute.tsx @@ -82,38 +82,38 @@ function HomeRoute({ return ( - - - - - - - {entry.name} - - - {entry.description && - {entry.description} - } - + + + + + + {entry.name} + + + {entry.description && + e.stopPropagation()} + target="_blank">{props.children} + }} + >{entry.description} + } + + - - - + + +