Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PHP_CLI_SERVER_WORKERS=4

BCRYPT_ROUNDS=12

LOG_CHANNEL=stack
LOG_CHANNEL=daily
LOG_STACK=single
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug
Expand Down
40 changes: 40 additions & 0 deletions app/View/Components/Button.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\View\Components;

use Illuminate\View\Component;
use Illuminate\View\View;

class Button extends Component
{
public string $type;
public ?string $loadingTarget;
public string $class;
public string $variant;

/**
* Create a new component instance.
*
* @param string $type
* @param string|null $loadingTarget
* @param string $class
* @param string $variant
*/
public function __construct(string $type = 'submit', string $loadingTarget = null, string $class = '', string $variant = 'blue')
{
$this->type = $type;
$this->loadingTarget = $loadingTarget;
$this->class = $class;
$this->variant = $variant;
}

/**
* Get the view / contents that represent the component.
*
* @return View
*/
public function render(): View
{
return view('components.button');
}
}
2 changes: 1 addition & 1 deletion resources/views/components/auth-session-status.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@props(['status'])

@if ($status)
<div class="flex items-center p-4 mb-4 text-green-800 rounded-lg bg-green-500" role="alert">
<div class="flex items-center p-4 mb-4 text-white rounded-lg bg-green-500" role="alert">
<svg class="shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
</svg>
Expand Down
41 changes: 41 additions & 0 deletions resources/views/components/button.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{{-- resources/views/components/button.blade.php --}}
@props([
'type' => 'submit',
'loadingTarget' => null,
'variant' => 'blue',
'class' => '',
])

@php
// Define color classes
$colorClasses = [
'blue' => 'bg-blue-700 hover:bg-blue-800 focus:ring-blue-300',
'green' => 'bg-green-700 hover:bg-green-800 focus:ring-green-300',
'red' => 'bg-red-700 hover:bg-red-800 focus:ring-red-300',
'yellow' => 'bg-yellow-700 hover:bg-yellow-800 focus:ring-yellow-300',
'indigo' => 'bg-indigo-700 hover:bg-indigo-800 focus:ring-indigo-300',
];

$selectedColor = $colorClasses[$variant] ?? $colorClasses['blue'];
@endphp

<button
{{ $attributes->merge([
'type' => $type,
'class' => "w-full text-white font-medium rounded-lg text-sm px-5 py-2.5 focus:ring-4 $selectedColor $class",
'wire:loading.attr' => 'disabled',
'wire:loading.class' => 'cursor-not-allowed opacity-50',
]) }}
@if($loadingTarget)
wire:target="{{ $loadingTarget }}"
@endif
>
{{ $slot }}

@if($loadingTarget)
<svg wire:loading wire:target="{{ $loadingTarget }}" aria-hidden="true" role="status" class="inline w-4 h-4 ms-2 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
</svg>
@endif
</button>
4 changes: 1 addition & 3 deletions resources/views/livewire/auth/confirm-password.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
<x-input-error :messages="$errors->get('password')" class="mt-2" />
</div>

<button type="submit" class="w-full text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">
Confirm Password
</button>
<x-button loadingTarget="confirmPassword">Create account</x-button>
</form>
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions resources/views/livewire/auth/forgot-password.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@
<x-input-error :messages="$errors->get('email')" class="mt-2" />
</div>

<button type="submit" class="w-full text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">
Email password reset link
</button>
<x-button loadingTarget="sendPasswordResetLink">Create account</x-button>

@if(Route::has('login'))
<div class="flex items-center justify-center">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/auth/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</div>
@endif

<button type="submit" class="w-full text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Sign in</button>
<x-button variant="blue" loadingTarget="login">Create account</x-button>

@if(Route::has('register'))
<div class="flex items-center justify-center">
Expand Down
2 changes: 1 addition & 1 deletion resources/views/livewire/auth/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<input type="password" wire:model="password_confirmation" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 rounded-lg focus:ring-blue-600 focus:border-blue-600 block w-full p-2.5" required="">
</div>

<button type="submit" class="w-full text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">Create account</button>
<x-button loadingTarget="register">Create account</x-button>

@if(Route::has('login'))
<div class="flex items-center justify-center">
Expand Down
4 changes: 1 addition & 3 deletions resources/views/livewire/auth/reset-password.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@
<input type="password" wire:model="password_confirmation" id="password_confirmation" placeholder="Confirm password" class="bg-gray-50 border border-gray-300 rounded-lg focus:ring-blue-600 focus:border-blue-600 block w-full p-2.5" required="">
</div>

<button type="submit" class="w-full text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">
Reset password
</button>
<x-button loadingTarget="resetPassword">Create account</x-button>

</form>
</div>
Expand Down
8 changes: 6 additions & 2 deletions resources/views/livewire/auth/verify-email.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
</div>

@if (session('status') == 'verification-link-sent')
<div class="p-4 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-gray-800 dark:text-green-400" role="alert">
<div class="p-4 mb-4 text-sm text-white rounded-lg bg-green-500" role="alert">
{{ __('A new verification link has been sent to the email address you provided during registration.') }}
</div>
@endif

<button type="button" wire:click="sendVerification" class="w-full text-white bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center">
<button wire:click="sendVerification" wire:loading.attr="disabled" wire:loading.class="cursor-not-allowed opacity-50" type="button" class="w-full text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5">
Resend verification email
<svg wire:loading wire:target="sendVerification" aria-hidden="true" role="status" class="inline w-4 h-4 ms-2 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
</svg>
</button>

@if(Route::has('logout'))
Expand Down