Skip to content

Commit 6e9602b

Browse files
authored
Merge pull request #10 from dansysanalyst/dev
Click to copy, Text Highlight & other improvements
2 parents c5b9ced + bddc99f commit 6e9602b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+681
-300
lines changed

README.md

+101-19
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
# WireUI - Docs
22

3-
Page for [WireUI](https://github.com/wireui/wireui) documentation.
3+
Page for [WireUI](https://github.com/wireui/wireui) documentation.
44

5-
🌐 Live at: [https://livewire-wireui.com/](https://livewire-wireui.com/)
6-
7-
Made with [Laravel](https://laravel.com) & [Livewire](https://laravel-livewire.com).
5+
Visit at: [https://livewire-wireui.com/](https://livewire-wireui.com/)
86

97
<br/>
108

@@ -14,45 +12,129 @@ Thank you for your interest in contributing! 😊
1412

1513
Please follow the steps below to run this project locally:
1614

17-
### Requirements
15+
### Get started 🚀
16+
17+
#### Requirements
1818

1919
- PHP 7.4+
2020
- [Composer](https://getcomposer.org)
2121
- [Yarn](https://yarnpkg.com)
2222
- A valid [Torchlight](https://torchlight.dev) token (free for non-profit open-source projects).
2323

24-
</br>
2524

26-
### Get started
25+
#### Setup
2726

28-
STEP 1: Fork this repository (Click on "Fork").
27+
**STEP 1:**
28+
29+
Fork this repository, click on "Fork" in this page.
2930

3031
<br/>
3132

32-
STEP 2: Clone your forked repository:
33+
**STEP 2:**
34+
35+
Clone your forked repository, run the command:
3336

3437
```bash
35-
git clone https://github.com/:::USERNAME:::/docs wireui-docs && cd wireui-docs
38+
git clone https://github.com/YOUR-USERNAME/docs wireui-docs && cd wireui-docs
3639
```
3740

38-
📝 **NOTE:** Replace _:::USERNAME:::_ with your GitHub username.
39-
4041
<br/>
4142

42-
STEP 3: Register and create your Torchlight token at [https://torchlight.dev](https://torchlight.dev).
43+
**STEP 3:**
4344

44-
You should have received a token similar to this:
45+
WireUI Doc uses Torchlight to provide code highlighting.
4546

46-
```bash
47-
torch_EFhVTgSra9HioAxtsK3ljnsj45BHmf
48-
```
47+
Before continuing, you must register at [https://torchlight.dev](https://torchlight.dev) and get your access token.
4948

50-
Store it safely for the next step.
49+
The token will be required in the next step, and it should look like similar to:
50+
51+
```bash
52+
torch_EFhVTgSra9HioAxtsK3ljnsj45BHmf
53+
```
5154

5255
<br/>
5356

54-
STEP 4: Execute the `run` script:
57+
**STEP 4:** In your project folder, execute the `run.sh` script:
5558

5659
```bash
5760
./run.sh
5861
```
62+
63+
This script automate the process of installing dependencies and set up the `.env` file.
64+
65+
<br>
66+
67+
---
68+
69+
### Doc syntax 📝
70+
71+
The WireUI Doc provides some components to facilitate the writing experience.
72+
73+
You are welcome to explore the code in `resources/views/livewire/` folder to view real usage examples.
74+
75+
<br/>
76+
77+
#### Code snippets
78+
79+
Code snippets should always be included using the `<x-code>` tag.
80+
81+
The mandatory attributes are `language`, for the code language and the `code`, for the code itself.
82+
83+
For example:
84+
85+
```php
86+
//...
87+
<x-code language="bash" :code="<<<EOT
88+
php artisan vendor:publish --tag='wireui.config'
89+
php artisan vendor:publish --tag='wireui.resources'
90+
php artisan vendor:publish --tag='wireui.lang'
91+
EOT" />
92+
```
93+
94+
A copy button is loaded by default, to suppress the button, add the attribute: `copy="false"`.
95+
96+
Likewise, line numbers are displayed by default. To remove the numbers, add the attribute: `line-number="false`.
97+
98+
```php
99+
<x-code copy="false" line-numbers="false" language="shell" :code="Command exit with error error code xyz...." />
100+
```
101+
102+
<br/>
103+
104+
#### Text mark
105+
106+
When giving instructions or using technical words, highlight important information with the `<x-mark>` tag.
107+
108+
For example, when using:
109+
110+
```php
111+
Run <x-mark>npm install<x-mark> to install all to install all dependencies.
112+
```
113+
114+
The outcome is similar to:
115+
116+
Run `npm install` to install all to install all dependencies.
117+
118+
<br/>
119+
120+
#### Boxes
121+
122+
Sometimes it's crucial to highlight information such as a mandatory step or a compatibility issue. In these situations, situations, you should use the `<x-box attention>` tag, which will produce a yellow "attention" box.
123+
124+
For example:
125+
126+
```php
127+
<x-box attention>If you are using FooJS 1.0, you must configure bar=null before update.</x-box>
128+
```
129+
130+
In addition, if you need to provide a friendly message, a tip, or extra information, you should use of the `<x-box info>` tag, which produces a blue info box.
131+
132+
```php
133+
<x-box info>Read more about supported formats <a href="#formats">here</a>.</x-box>
134+
```
135+
136+
<br/>
137+
138+
---
139+
140+
WireUI Doc runs on [Laravel](https://laravel.com) & [Livewire](https://laravel-livewire.com).

app/Console/Kernel.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected function schedule(Schedule $schedule)
2525
*/
2626
protected function commands()
2727
{
28-
$this->load(__DIR__.'/Commands');
28+
$this->load(__DIR__ . '/Commands');
2929

3030
require base_path('routes/console.php');
3131
}

app/Http/Livewire/Documentation/DatetimePicker.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class DatetimePicker extends Component
5757
label="Appointment Date"
5858
placeholder="Appointment Date"
5959
wire:model="model"
60-
:min="now()->subDays(7)->hours(12)->minutes(12)"
61-
:max="now()->addDays(7)->hours(12)->minutes(12)"
60+
:min="now()->subDays(7)->hours(12)->minutes(30)"
61+
:max="now()->addDays(7)->hours(12)->minutes(30)"
6262
/>
6363
HTML;
6464

app/Http/Livewire/Documentation/Inputs.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
class Inputs extends Component
99
{
10+
public string $wireModelExample = <<<HTML
11+
<x-input wire:model="firstName" label="Name" placeholder="User's first name" />
12+
HTML;
13+
1014
public string $simpleInputExample = <<<HTML
1115
<x-input label="Name" placeholder="your name" />
1216
HTML;
@@ -32,7 +36,7 @@ class Inputs extends Component
3236
HTML;
3337

3438
public string $prefixInputExample = <<<HTML
35-
<x-input label="Name" placeholder="your name" prefix="$" />
39+
<x-input class="!pl-[6.5rem]" label="Website" placeholder="your-website.com" prefix="https://www." />
3640
HTML;
3741

3842
public string $suffixInputExample = <<<HTML
@@ -44,7 +48,7 @@ class Inputs extends Component
4448
<x-slot name="prepend">
4549
<div class="absolute inset-y-0 left-0 flex items-center p-0.5">
4650
<x-button
47-
class="rounded-l-md h-full"
51+
class="h-full rounded-l-md"
4852
icon="sort-ascending"
4953
primary
5054
flat
@@ -60,7 +64,7 @@ class="rounded-l-md h-full"
6064
<x-slot name="append">
6165
<div class="absolute inset-y-0 right-0 flex items-center p-0.5">
6266
<x-button
63-
class="rounded-r-md h-full"
67+
class="h-full rounded-r-md"
6468
icon="sort-ascending"
6569
primary
6670
flat
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
namespace App\Http\Livewire\Documentation;
4+
5+
use App\View\Components\Layouts\Documentation;
6+
use Livewire\Component;
7+
8+
class LivewireUsage extends Component
9+
{
10+
public function render()
11+
{
12+
return view('livewire.documentation.usage')->layout(Documentation::class);
13+
}
14+
}

app/Http/Livewire/Documentation/Textarea.php

+4
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
class Textarea extends Component
99
{
10+
public string $wireModelExample = <<<HTML
11+
<x-textarea wire:model="comment" label="Comment" placeholder="Your comment" />
12+
HTML;
13+
1014
public string $simpleExample = <<<HTML
1115
<x-textarea label="Annotations" placeholder="write your annotations" />
1216
HTML;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
namespace App\Http\Livewire\Documentation;
4+
5+
use App\View\Components\Layouts\Documentation;
6+
use Livewire\Component;
7+
8+
class Troubleshooting extends Component
9+
{
10+
public string $tailwindFormsError = <<<SHELL
11+
ERROR in ./resources/css/app.css
12+
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
13+
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
14+
TypeError: require(...) is not a function
15+
...
16+
1 ERROR in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
17+
webpack compiled with 2 errors
18+
SHELL;
19+
20+
public string $tailwindFormsUpdate = <<<JS
21+
"devDependencies": {
22+
"@tailwindcss/forms": "^0.3.0",
23+
//..
24+
}
25+
JS;
26+
27+
public function render()
28+
{
29+
return view('livewire.documentation.troubleshooting')->layout(Documentation::class);
30+
}
31+
}

app/Http/Middleware/Authenticate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class Authenticate extends Middleware
1414
*/
1515
protected function redirectTo($request)
1616
{
17-
if (! $request->expectsJson()) {
17+
if (!$request->expectsJson()) {
1818
return route('login');
1919
}
2020
}

app/Http/Middleware/TrustProxies.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,5 @@ class TrustProxies extends Middleware
1919
*
2020
* @var int
2121
*/
22-
protected $headers =
23-
Request::HEADER_X_FORWARDED_FOR |
24-
Request::HEADER_X_FORWARDED_HOST |
25-
Request::HEADER_X_FORWARDED_PORT |
26-
Request::HEADER_X_FORWARDED_PROTO |
27-
Request::HEADER_X_FORWARDED_AWS_ELB;
22+
protected $headers = Request::HEADER_X_FORWARDED_FOR | Request::HEADER_X_FORWARDED_HOST | Request::HEADER_X_FORWARDED_PORT | Request::HEADER_X_FORWARDED_PROTO | Request::HEADER_X_FORWARDED_AWS_ELB;
2823
}

app/Models/User.php

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace App\Models;
44

5-
use Illuminate\Contracts\Auth\MustVerifyEmail;
65
use Illuminate\Database\Eloquent\Factories\HasFactory;
76
use Illuminate\Foundation\Auth\User as Authenticatable;
87
use Illuminate\Notifications\Notifiable;

app/Providers/AuthServiceProvider.php

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace App\Providers;
44

55
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
6-
use Illuminate\Support\Facades\Gate;
76

87
class AuthServiceProvider extends ServiceProvider
98
{

0 commit comments

Comments
 (0)