From 9df425eb8ff289f96c8772178626c60b4609f31e Mon Sep 17 00:00:00 2001 From: Akalanka Perera Date: Fri, 5 Apr 2024 21:41:31 +0530 Subject: [PATCH] Fix: added on reload event --- src/components/workspace/index.tsx | 4 +++- src/components/workspace/reload.tsx | 7 ++++++- src/types/index.ts | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/workspace/index.tsx b/src/components/workspace/index.tsx index 44cb63a..7cd3209 100644 --- a/src/components/workspace/index.tsx +++ b/src/components/workspace/index.tsx @@ -135,7 +135,9 @@ export const Workspace: React.FC = (props) => { )} {showZoomControls && } {showVisibilityControls && } - {showReloadButton && } + {showReloadButton && ( + + )} ); }; diff --git a/src/components/workspace/reload.tsx b/src/components/workspace/reload.tsx index 3534b96..82bcdb2 100644 --- a/src/components/workspace/reload.tsx +++ b/src/components/workspace/reload.tsx @@ -4,7 +4,11 @@ import { twMerge } from "tailwind-merge"; import { ids } from "@/constants"; import type { ISTKProps } from "@/types"; -const Reloader = (props: Pick) => { +interface IProps extends Pick { + onReload: () => void; +} + +const Reloader = (props: IProps) => { return (
) => { props.styles?.reloadButton?.className )} style={props.styles?.reloadButton?.properties} + onClick={props?.onReload} >
diff --git a/src/types/index.ts b/src/types/index.ts index ebececc..954e009 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -34,6 +34,8 @@ export interface IEvents { onSectionClick?: (section: ISection) => void; onExport?: (data: ISTKData) => void; onWorkspaceLoad?: () => void; + /** Only used when the reload button is enabled */ + onReload?: () => void; } export interface ISTKData {