Skip to content

Commit

Permalink
Merge pull request #94 from OrangeJuiced/main
Browse files Browse the repository at this point in the history
Fixes step navigation when there are multiple wizards on a page
  • Loading branch information
freekmurze authored Sep 13, 2023
2 parents bea9b0d + 3cbefbd commit 29c01c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Components/StepComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ abstract class StepComponent extends Component
{
use StepAware;

public ?string $wizardClassName = null;

public array $allStepNames = [];
public array $allStepsState = [];

Expand All @@ -19,17 +21,17 @@ abstract class StepComponent extends Component

public function previousStep()
{
$this->dispatch('previousStep', $this->state()->currentStep());
$this->dispatch('previousStep', $this->state()->currentStep())->to($this->wizardClassName);
}

public function nextStep()
{
$this->dispatch('nextStep', $this->state()->currentStep());
$this->dispatch('nextStep', $this->state()->currentStep())->to($this->wizardClassName);
}

public function showStep(string $stepName)
{
$this->dispatch('showStep', toStepName: $stepName, currentStepState: $this->state()->currentStep());
$this->dispatch('showStep', toStepName: $stepName, currentStepState: $this->state()->currentStep())->to($this->wizardClassName);
}

public function hasPreviousStep()
Expand Down
1 change: 1 addition & 0 deletions src/Components/WizardComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public function getCurrentStepState(?string $step = null): array
'allStepNames' => $this->stepNames()->toArray(),
'allStepsState' => $this->allStepState,
'stateClassName' => $this->stateClass(),
'wizardClassName' => static::class,
],
);
}
Expand Down

0 comments on commit 29c01c6

Please sign in to comment.