mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-19 22:01:46 +03:00
feat: kanban card open sub page
This commit is contained in:
parent
de510ba5ae
commit
bac8c91497
@ -25,7 +25,7 @@ const AddCard = ({ group }: { group: KanbanGroup }) => {
|
|||||||
const { addCard } = useKanban();
|
const { addCard } = useKanban();
|
||||||
const handleClick = useCallback(async () => {
|
const handleClick = useCallback(async () => {
|
||||||
await addCard(group);
|
await addCard(group);
|
||||||
}, [addCard]);
|
}, [addCard, group]);
|
||||||
return <AddCardWrapper onClick={handleClick}>+</AddCardWrapper>;
|
return <AddCardWrapper onClick={handleClick}>+</AddCardWrapper>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
import type { KanbanCard } from '@toeverything/components/editor-core';
|
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';
|
import { styled } from '@toeverything/components/ui';
|
||||||
|
|
||||||
const CardContent = styled('div')({
|
const CardContent = styled('div')({
|
||||||
@ -58,12 +62,17 @@ export const CardItem = ({
|
|||||||
block: KanbanCard['block'];
|
block: KanbanCard['block'];
|
||||||
}) => {
|
}) => {
|
||||||
const { addSubItem } = useKanban();
|
const { addSubItem } = useKanban();
|
||||||
|
const { openSubPage } = useSubPage();
|
||||||
const onAddItem = async () => {
|
const onAddItem = async () => {
|
||||||
await addSubItem(block);
|
await addSubItem(block);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const onClickCard = async () => {
|
||||||
|
openSubPage(id);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CardContainer>
|
<CardContainer onClick={onClickCard}>
|
||||||
<CardContent>
|
<CardContent>
|
||||||
<RenderBlock blockId={id} />
|
<RenderBlock blockId={id} />
|
||||||
</CardContent>
|
</CardContent>
|
||||||
|
Loading…
Reference in New Issue
Block a user