Skip to content

Commit

Permalink
fix: types in Stepper
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasdigby committed Aug 21, 2023
1 parent 33b1793 commit 83f214b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/src/components/stepper/StepperStepForward.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const StepperStepForward: React.FC<
if (onClick) {
return onClick(goToNextStep)
}
goToNextStep?.()
goToNextStep()
}

return (
Expand Down
12 changes: 6 additions & 6 deletions lib/src/components/stepper/stepper-context/StepperContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { Context, StepperProviderProps } from '../types'

const StepperContext = React.createContext<Context>({
steps: [],
goToPreviousStep: () => null,
goToNextStep: () => null,
goToStep: () => null,
goToPreviousStep: () => undefined,
goToNextStep: () => undefined,
goToStep: () => undefined,
activeStep: 0,
viewedSteps: [],
allowSkip: false,
Expand Down Expand Up @@ -72,9 +72,9 @@ export const StepperProvider: React.FC<StepperProviderProps> = ({
<StepperContext.Provider
value={{
steps: steps || Array(stepCount).fill(''),
goToPreviousStep: isControlled ? undefined : goToPreviousStep,
goToNextStep: isControlled ? undefined : goToNextStep,
goToStep: isControlled ? undefined : goToStep,
goToPreviousStep: isControlled ? () => undefined : goToPreviousStep,
goToNextStep: isControlled ? () => undefined : goToNextStep,
goToStep: isControlled ? () => undefined : goToStep,
activeStep,
viewedSteps,
completedSteps,
Expand Down
6 changes: 3 additions & 3 deletions lib/src/components/stepper/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ export type Direction = 'vertical' | 'horizontal'

export type Context = {
steps: Step[]
goToPreviousStep?: () => void
goToNextStep?: () => void
goToStep?: (index: number) => void
goToPreviousStep: () => void | undefined
goToNextStep: () => void | undefined
goToStep: (index: number) => void | undefined
activeStep: number
viewedSteps: number[]
completedSteps: number[]
Expand Down

0 comments on commit 83f214b

Please sign in to comment.