Skip to content

Commit

Permalink
Merge pull request #3 from trippo/main
Browse files Browse the repository at this point in the history
Add setModel on steps after reset + UI refactoring
  • Loading branch information
vildanbina authored Apr 4, 2022
2 parents de1d6b5 + b2b16bf commit 157ff97
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions resources/views/step-header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="bg-gray-200 rounded flex-1">
<div
@class([
'rounded py-1',
'rounded py-0.5',
'bg-green-300' => $stepIsGreaterOrEqualThan && !$isFailedStep,
'bg-red-300' => $isFailedStep,
'w-full' => $isFailedStep || $stepIsGreaterOrEqualThan,
Expand All @@ -21,7 +21,7 @@
</div>
@endif

<div class="w-10 mx-auto">
<div class="grid place-items-center">
<x-button.circle
:positive="$stepIsGreaterOrEqualThan && !$isFailedStep"
:negative="$isFailedStep"
Expand Down
12 changes: 6 additions & 6 deletions resources/views/steps-footer.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<div>
@if($this->hasPrevStep())
<x-button dark label="Back" wire:click="goToPrevStep" spinner="goToPrevStep"/>
@endif
<div class="p-2 flex flex-row-reverse justify-between">
@if($this->hasNextStep())
<x-button primary wire:click="goToNextStep" spinner="goToNextStep" label="Next"/>
<x-button lg primary right-icon="chevron-right" wire:click="goToNextStep" spinner="goToNextStep" :label="__('Next')"/>
@else
<x-button primary type="submit" spinner="submit" label="Submit"/>
<x-button lg primary type="submit" spinner="submit" :label="__('Submit')"/>
@endif
@if($this->hasPrevStep())
<x-button lg dark :label="__('Back')" icon="chevron-left" wire:click="goToPrevStep" spinner="goToPrevStep"/>
@endif
</div>
2 changes: 1 addition & 1 deletion resources/views/steps-header.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="w-full py-6">
<div class="w-full pb-6 pt-2">
<div class="flex">
@foreach($stepInstances as $stepInstance)
@include('livewire-wizard::step-header')
Expand Down
4 changes: 2 additions & 2 deletions resources/views/wizard.blade.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<div>
<x-errors/>
<form wire:submit.prevent="save">
@include('livewire-wizard::steps-header')
<div class="container p-4">
<x-errors/>
<div class="container p-4 mx-auto">
{{ $this->getCurrentStep() }}
</div>

Expand Down
5 changes: 5 additions & 0 deletions src/WizardComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ public function mount()
}

$this->stepClasses(function (Step $step) {

if (method_exists($this, 'model')) {
$step->setModel($this->model);
}

if (method_exists($step, 'mount')) {
$step->mount();
}
Expand Down

0 comments on commit 157ff97

Please sign in to comment.