From bac8c91497af7156ae50e29e41034f4706fbe0b9 Mon Sep 17 00:00:00 2001
From: lawvs <18554747+lawvs@users.noreply.github.com>
Date: Tue, 2 Aug 2022 19:10:16 +0800
Subject: [PATCH] feat: kanban card open sub page
---
.../src/blocks/group/scene-kanban/CardContext.tsx | 2 +-
.../src/blocks/group/scene-kanban/CardItem.tsx | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardContext.tsx b/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardContext.tsx
index cb313d14ee..f7f05b37d4 100644
--- a/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardContext.tsx
+++ b/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardContext.tsx
@@ -25,7 +25,7 @@ const AddCard = ({ group }: { group: KanbanGroup }) => {
const { addCard } = useKanban();
const handleClick = useCallback(async () => {
await addCard(group);
- }, [addCard]);
+ }, [addCard, group]);
return +;
};
diff --git a/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx b/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx
index f26374e4c3..d4ce7e8486 100644
--- a/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx
+++ b/libs/components/editor-blocks/src/blocks/group/scene-kanban/CardItem.tsx
@@ -1,5 +1,9 @@
import type { KanbanCard } from '@toeverything/components/editor-core';
-import { RenderBlock, useKanban } from '@toeverything/components/editor-core';
+import {
+ RenderBlock,
+ useKanban,
+ useSubPage,
+} from '@toeverything/components/editor-core';
import { styled } from '@toeverything/components/ui';
const CardContent = styled('div')({
@@ -58,12 +62,17 @@ export const CardItem = ({
block: KanbanCard['block'];
}) => {
const { addSubItem } = useKanban();
+ const { openSubPage } = useSubPage();
const onAddItem = async () => {
await addSubItem(block);
};
+ const onClickCard = async () => {
+ openSubPage(id);
+ };
+
return (
-
+