Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ function Signup() {
stepCount={3}
isBackDisabled={(index) => { return index === 0 }}
isNextDisabled={(index) => { return false }}
isBackLoading={(index) => { return false }}
isNextLoading={(index) => { return false }}
onBack={(index) => { console.log('back clicked on step', index) }}
onNext={(index) => { console.log('next clicked on step', index) }}
>
Expand Down
10 changes: 10 additions & 0 deletions src/PromenadeContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ type PromenadeContextType = {
* @default false
*/
isBackDisabled: boolean;
/**
* Whether the next button is loading
* @default () => false
*/
isNextLoading?: boolean;
/**
* Whether the back button is loading
* @default () => false
* */
isBackLoading?: boolean;
/**
* Function to go forward to the next step.
*/
Expand Down
18 changes: 15 additions & 3 deletions src/PromenadeProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React, {
ReactElement,
ReactNode,
useCallback,
useMemo,
useState,
} from "react";
import { PromenadeContext } from "@/src/PromenadeContext";
import { PromenadeStep } from "@/src/PromenadeStep";

type PromenadeProviderProps = {
/**
Expand All @@ -27,6 +24,16 @@ type PromenadeProviderProps = {
* @default () => false
*/
isBackDisabled?: (index: number) => boolean;
/**
* Whether the next button is loading
* @default () => false
*/
isNextLoading?: (index: number) => boolean;
/**
* Whether the back button is loading
* @default () => false
* */
isBackLoading?: (index: number) => boolean;
/**
* Callback for when the user clicks the back button
*/
Expand All @@ -42,6 +49,8 @@ export const PromenadeProvider = ({
stepCount,
isNextDisabled = () => false,
isBackDisabled = () => false,
isNextLoading = () => false,
isBackLoading = () => false,
onBack,
onNext
}: PromenadeProviderProps) => {
Expand Down Expand Up @@ -80,6 +89,9 @@ export const PromenadeProvider = ({
isNextDisabled: isNextDisabled(index),
isBackDisabled: isBackDisabled(index),

isNextLoading: isNextLoading(index),
isBackLoading: isBackLoading(index),

goForward,
goBack,
cancelFlow,
Expand Down
Loading