Skip to content

Commit 26cc256

Browse files
committed
add input number doc
1 parent 8480196 commit 26cc256

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace App\Http\Livewire\Documentation;
4+
5+
use App\View\Components\Layouts\Documentation;
6+
use Illuminate\Contracts\View\View;
7+
use Livewire\Component;
8+
9+
class NumberInput extends Component
10+
{
11+
public string $passwordExample = <<<HTML
12+
<x-inputs.password label="Secret 🙈" value="I love WireUI ❤️" />
13+
HTML;
14+
15+
public string $holdExample = <<<HTML
16+
<div x-data="{ count: 0 }" class="flex items-center gap-x-3">
17+
<x-button x-hold.click.repeat.200ms="count--" icon="minus" />
18+
19+
<span class="bg-teal-600 text-white px-5 py-1.5" x-text="count"></span>
20+
21+
<x-button x-hold.click.repeat.200ms="count++" icon="plus" />
22+
</div>
23+
HTML;
24+
25+
public function render(): View
26+
{
27+
return view('livewire.documentation.number-input')->layout(Documentation::class);
28+
}
29+
}

app/View/Components/Layouts/Documentation.php

+4
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ public function getSidebarMenu(): array
3838
'label' => 'Password Input',
3939
'route' => route('docs.inputs.password'),
4040
],
41+
[
42+
'label' => 'Number Input',
43+
'route' => route('docs.inputs.number'),
44+
],
4145
[
4246
'label' => 'Textarea',
4347
'route' => route('docs.textarea'),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<div class="space-y-10">
2+
<x-slot name="summary">
3+
<x-summary>
4+
<x-summary.header href="#inputs" label="Number Input">
5+
<x-summary.item href="#number-input" label="Number Input" />
6+
</x-summary.header>
7+
8+
<x-summary.header href="#input-options" label="Inputs Options" />
9+
</x-summary>
10+
</x-slot>
11+
12+
<div>
13+
<x-section.title id="inputs" title="Number Input" />
14+
15+
<div class="mt-5 prose text-gray-500 xl:max-w-4xl xl:mb-8 dark:text-gray-400">
16+
This component will add an easy way to manipulate numbers, like ecommerce products quantity.
17+
</div>
18+
</div>
19+
20+
<div class="space-y-4">
21+
<x-code-preview
22+
title="Number Input"
23+
href="#number-input"
24+
id="number-input"
25+
language="blade"
26+
:code="$passwordExample">
27+
<div class="max-w-sm mx-auto">
28+
<x-inputs.number label="How many Burgers?" />
29+
</div>
30+
</x-code-preview>
31+
32+
<p>
33+
See more about the <x-mark>x-hold</x-mark> directive
34+
<a class="underline" href="https://www.npmjs.com/package/@wireui/alpinejs-hold-directive">here</a>
35+
</p>
36+
37+
<div x-data="{ count: 0 }" class="flex items-center gap-x-3">
38+
<x-button x-hold.click.repeat.200ms="count--" icon="minus" />
39+
40+
<span class="bg-teal-600 text-white px-5 py-1.5 rounded-lg" x-text="count"></span>
41+
42+
<x-button x-hold.click.repeat.200ms="count++" icon="plus" />
43+
</div>
44+
45+
<x-code language="blade" :contents="$holdExample" />
46+
</div>
47+
48+
<div id="input-options">
49+
<x-section.title href="#input-options" title="Input Options" />
50+
51+
<div class="mt-5 prose xl:max-w-3xl xl:mb-8 text-gray-500">
52+
<p>
53+
The phone input accepts all
54+
<a class="dark:text-secondary-500" href="{{ route('docs.inputs') }}#input-options">input</a>
55+
options and slots
56+
</p>
57+
</div>
58+
</div>
59+
</div>

routes/web.php

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
Route::get('hooks', Documentation\Hooks::class)->name('hooks');
2727
Route::get('inputs', Documentation\Inputs::class)->name('inputs');
2828
Route::get('inputs-password', Documentation\PasswordInput::class)->name('inputs.password');
29+
Route::get('inputs-number', Documentation\NumberInput::class)->name('inputs.number');
2930
Route::get('errors', Documentation\Errors::class)->name('errors');
3031
Route::get('maskable-inputs', Documentation\MaskableInput::class)->name('maskable-inputs');
3132
Route::get('phone-input', Documentation\PhoneInput::class)->name('phone-input');

0 commit comments

Comments
 (0)