From 60804278dfc6e5e5e77e75a70e82ea1cf969a7c3 Mon Sep 17 00:00:00 2001 From: ohadmata Date: Thu, 29 Aug 2024 16:01:50 +0300 Subject: [PATCH] add medium size to table resize button --- src/pages/editor-page/canvas/table-node.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/editor-page/canvas/table-node.tsx b/src/pages/editor-page/canvas/table-node.tsx index 08a12a16..55050723 100644 --- a/src/pages/editor-page/canvas/table-node.tsx +++ b/src/pages/editor-page/canvas/table-node.tsx @@ -21,6 +21,7 @@ export type TableNodeType = Node< >; const MAX_TABLE_SIZE = 450; +const MID_TABLE_SIZE = 337; const MIN_TABLE_SIZE = 224; export const TableNode: React.FC> = ({ @@ -40,9 +41,12 @@ export const TableNode: React.FC> = ({ const expandTable = useCallback(() => { updateTable(table.id, { - width: MAX_TABLE_SIZE, + width: + (table.width ?? 224) < MID_TABLE_SIZE + ? MID_TABLE_SIZE + : MAX_TABLE_SIZE, }); - }, [table.id, updateTable]); + }, [table.id, table.width, updateTable]); const shrinkTable = useCallback(() => { updateTable(table.id, {