Skip to content

Commit

Permalink
added close functions to next/prev component props
Browse files Browse the repository at this point in the history
  • Loading branch information
Eitan Elbaz committed Jun 27, 2023
1 parent 62b1d66 commit 90657ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ const Modal = ({
goNext={() => changeStep(stepIndex + 1)}
skipTo={changeStep}
totalSteps={allSteps.length}
close={close}
/>
),
[stepIndex, changeStep, allSteps.length, NextStepButton],
[stepIndex, changeStep, allSteps.length, NextStepButton, close],
);
const previousStepButton = useMemo(
() => (
Expand All @@ -68,9 +69,10 @@ const Modal = ({
goBack={() => changeStep(stepIndex - 1)}
skipTo={changeStep}
totalSteps={allSteps.length}
close={close}
/>
),
[stepIndex, changeStep, allSteps.length, PreviousStepButton],
[stepIndex, changeStep, allSteps.length, PreviousStepButton, close],
);
const stepButtonWrapper = useMemo(
() => (
Expand Down
4 changes: 3 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { PropsWithChildren, ReactNode } from 'react';
export type ReactGrandTourProps = ComponentVisibility & {
open?: boolean;
onOpen?: () => void;
onClose?: (reason: ReactGrandTourCloseReason) => void;
onClose?: (reason?: ReactGrandTourCloseReason) => void;
onStepChange?: (props: OnStepChangeProps) => void;
openAt?: number;
steps?: ReactGrandTourStep[];
Expand Down Expand Up @@ -189,12 +189,14 @@ export type NextStepButtonProps = {
totalSteps: number;
goNext: () => void;
skipTo: (step: number) => void;
close: () => void;
};
export type PreviousStepButtonProps = {
currentStep: number;
totalSteps: number;
goBack: () => void;
skipTo: (step: number) => void;
close: () => void;
};
export type StepButtonProps = {
currentStep: number;
Expand Down

0 comments on commit 90657ff

Please sign in to comment.