Skip to content

Commit 6c66cb9

Browse files
committed
Renamed several files and directories to improve code organization and consistency.
1 parent 5936596 commit 6c66cb9

15 files changed

+57
-50
lines changed

resources/views/components/modal/form/collapsible-text-area.blade.php resources/views/components/collapsible-text-area.blade.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
<div class="mt-2">
1+
<div>
22
<a href="#" @click="open = !open"
33
class="text-blue-500 hover:text-blue-700 cursor-pointer hover:underline">
44
{{ $toggleText }}
55
</a>
6-
<div class="flex flex-col pt-2"
6+
<div class="flex flex-col py-2"
77
x-show="open"
88
x-transition:enter="transition ease-out duration-300"
99
x-transition:enter-start="opacity-0 scale-95"
@@ -24,6 +24,6 @@ class="text-blue-500 hover:text-blue-700 cursor-pointer hover:underline">
2424
class="mt-2 block w-full rounded-md border-0 px-3.5 py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-600 sm:sm:leading-6">
2525
{{ old($name) }}
2626
</textarea>
27-
@include('laravel-form::components.modal.form.error', ['errorKey' => 'message'])
27+
<x-laravel-form::error :errorKey="$name" />
2828
</div>
2929
</div>

resources/views/components/modal/modal.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class="fixed inset-0 bg-white bg-opacity-75 flex justify-center items-center fle
1616
<div class="bg-white rounded-lg p-4 shadow-lg max-w-lg w-full border" @click.stop>
1717
<x-laravel-form::modal.title :title="'Your Project Info'" />
1818
@if(isset($step) && $step === 1)
19-
<x-laravel-form::modal.steps.step-one :title="'Where do you need painting?'" />
19+
<x-laravel-form::steps.step-one :title="'Where do you need painting?'" />
2020
@endif
2121
@if(isset($step) && $step === 2)
22-
<x-laravel-form::modal.steps.step-two />
22+
<x-laravel-form::steps.step-two />
2323
@endisset
2424
</div>
2525

resources/views/components/modal/steps/step-one.blade.php

-29
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<form method="POST" action="{{ route('form.handle.step') }}">
2+
@csrf
3+
<div class="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2 py-6">
4+
@isset($title)
5+
<div class="col-span-2">
6+
<h3 class="my-1 text-gray-900 lg:text-2xl font-extrabold">{{ $title }}</h3>
7+
</div>
8+
@endisset
9+
10+
<input type="text" name="gotcha" style="display:none"/>
11+
12+
<div class="sm:col-span-1">
13+
<div class="flex space-x-2 pt-4">
14+
<div>
15+
<x-laravel-form::buttons.location-button :location="'inside'" />
16+
</div>
17+
<div>
18+
<x-laravel-form::buttons.location-button :location="'outside'" />
19+
</div>
20+
<div>
21+
<x-laravel-form::buttons.location-button :location="'cabinets'" />
22+
</div>
23+
</div>
24+
</div>
25+
26+
<div class="sm:col-span-2">
27+
<x-laravel-form::error :errorKey="'location'" />
28+
</div>
29+
</div>
30+
31+
<x-laravel-form::divider />
32+
33+
<div class="flex justify-between items-center text-center">
34+
<x-laravel-form::buttons.submit-button :buttonText="'Next'" />
35+
<x-laravel-form::modal.optional-div />
36+
</div>
37+
</form>

resources/views/components/modal/steps/step-two.blade.php resources/views/components/steps/step-two.blade.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<form method="POST" action="{{ route('form.handle.step') }}">
22
@csrf
3-
<div class="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2 pt-6">
3+
<div class="grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2 pt-6 pb-4">
44
@isset($title))
55
<div class="col-span-2">
66
<h3 class="my-1 text-gray-900 lg:text-2xl font-extrabold">{{ $title }}</h3>
@@ -9,7 +9,7 @@
99
<input type="text" name="isSpam" style="display:none"/>
1010

1111
<div class="sm:col-span-1">
12-
@include('laravel-form::components.modal.form.text-input', [
12+
@include('laravel-form::components.text-input', [
1313
'label' => 'First Name:',
1414
'type' => 'text',
1515
'name' => 'firstName',
@@ -19,7 +19,7 @@
1919
</div>
2020

2121
<div class="sm:col-span-1">
22-
@include('laravel-form::components.modal.form.text-input', [
22+
@include('laravel-form::components.text-input', [
2323
'label' => 'Last Name:',
2424
'type' => 'text',
2525
'name' => 'lastName',
@@ -29,7 +29,7 @@
2929
</div>
3030

3131
<div class="sm:col-span-2">
32-
@include('laravel-form::components.modal.form.text-input', [
32+
@include('laravel-form::components.text-input', [
3333
'label' => 'Email Address:',
3434
'type' => 'email',
3535
'name' => 'email',
@@ -39,7 +39,7 @@
3939
</div>
4040

4141
<div class="sm:col-span-1">
42-
@include('laravel-form::components.modal.form.text-input', [
42+
@include('laravel-form::components.text-input', [
4343
'label' => 'Phone:',
4444
'type' => 'phone',
4545
'name' => 'phone',
@@ -49,7 +49,7 @@
4949
</div>
5050

5151
<div class="sm:col-span-1">
52-
@include('laravel-form::components.modal.form.text-input', [
52+
@include('laravel-form::components.text-input', [
5353
'label' => 'Zip Code:',
5454
'type' => 'zipCode',
5555
'name' => 'zipCode',
@@ -59,7 +59,7 @@
5959
</div>
6060

6161
<div x-data="{ open: false }" class="sm:col-span-2">
62-
@include('laravel-form::components.modal.form.collapsible-text-area', [
62+
@include('laravel-form::components.collapsible-text-area', [
6363
'toggleText' => 'Add additional project info (optional)',
6464
'label' => 'Message:',
6565
'id' => 'message',
@@ -68,22 +68,22 @@
6868
'hint' => 'Max 255 characters'
6969
])
7070
</div>
71-
<div class="sm:col-span-2 pb-6">
72-
<x-laravel-form::modal.form.error :errorKey="'form.submit.limit'" />
71+
<div class="sm:col-span-2">
72+
{{--<x-laravel-form::components.error :errorKey="'form.submit.limit'" />--}}
7373
</div>
7474
</div>
7575

7676
<input type="text" name="gotcha" style="display:none"/>
7777
<x-laravel-form::meta />
7878
<input type="hidden" name="form_key" value="{{ LaravelForm::getModalFormKey() }}">
7979

80-
@include('laravel-form::components.modal.form.divider')
80+
<x-laravel-form::divider />
8181

8282
<div class="flex justify-between items-center w-full">
8383
<div class="flex space-x-4 pr-4 md:pr-0">
84-
<x-laravel-form::modal.buttons.fake-button :buttonText="'Submit'" />
85-
<x-laravel-form::modal.buttons.back-button :buttonText="'Back'" />
86-
<x-laravel-form::modal.buttons.submit-button :buttonText="'Submit'" />
84+
<x-laravel-form::buttons.fake-button :buttonText="'Submit'" />
85+
<x-laravel-form::buttons.back-button :buttonText="'Back'" />
86+
<x-laravel-form::buttons.submit-button :buttonText="'Submit'" />
8787
</div>
8888

8989
<x-laravel-form::modal.optional-div />

resources/views/components/modal/form/text-input.blade.php resources/views/components/text-input.blade.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
value="{{ old($name) }}"
1212
class="block w-full rounded-md border-0 px-3.5 py-2 text-gray-900 shadow-sm ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-gray-600 sm:sm:leading-6"
1313
/>
14-
@include('laravel-form::components.modal.form.error', ['errorKey' => $name])
14+
<x-laravel-form::error :errorKey="$name" />
1515
</div>
1616
</div>

src/FormServiceProvider.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function registeringPackage(): void
4242
});
4343

4444
Route::get('/thank-you', function () {
45-
return view('laravel-form::thank-you');
45+
return view('laravel-form::components.thank-you');
4646
})->name('thank-you');
4747
}
4848
}

src/Traits/FormSubmitLimitTrait.php

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ public function formSubmitLimitExceeded(Request $request): bool
1515
{
1616
if (App::environment('production') && ! config('app.debug')) {
1717
$lastSubmit = session('last_form_submit');
18-
$request->session()->put('form_step', 2);
1918

2019
return $lastSubmit && now()->diffInMinutes(Carbon::parse($lastSubmit)) < 60;
2120
}

0 commit comments

Comments
 (0)