From 31d7477b376501bd80fe635b91412bc7f6ae7ea7 Mon Sep 17 00:00:00 2001 From: "Thomas F. K. Jorna" Date: Sat, 9 Oct 2021 22:20:34 +0200 Subject: feat(preview): node history --- components/Sidebar/Toolbar.tsx | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'components/Sidebar/Toolbar.tsx') diff --git a/components/Sidebar/Toolbar.tsx b/components/Sidebar/Toolbar.tsx index 458361f..f6f1e39 100644 --- a/components/Sidebar/Toolbar.tsx +++ b/components/Sidebar/Toolbar.tsx @@ -9,21 +9,51 @@ import { BiRightIndent, } from 'react-icons/bi' import { ChevronLeftIcon, ChevronRightIcon } from '@chakra-ui/icons' +import { NodeObject } from 'force-graph' export interface ToolbarProps { setJustification: any justification: number setIndent: any setFont: any + setPreviewNode: any + canUndo: any + canRedo: any + resetPreviewNode: any + previousPreviewNode: any + nextPreviewNode: any } export const Toolbar = (props: ToolbarProps) => { - const { setJustification, setIndent, setFont, justification } = props + const { + setJustification, + setIndent, + setFont, + justification, + setPreviewNode, + canUndo, + canRedo, + resetPreviewNode, + previousPreviewNode, + nextPreviewNode, + } = props return ( - } aria-label="Previous node" /> - } aria-label="Previous node" /> + } + aria-label="Previous node" + disabled={!canUndo} + onClick={() => previousPreviewNode()} + /> + } + aria-label="Next node" + disabled={!canRedo} + onClick={() => nextPreviewNode()} + />