-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
@if($type === 'link') | ||
<x-splade-link {{ $attributes->class([ | ||
'text-left w-full px-4 py-2 text-sm font-normal', | ||
'text-danger-700 dark:text-white dark:hover:bg-danger-600 hover:bg-gray-50 hover:text-danger-900' => $danger, | ||
'text-warning-700 dark:text-white dark:hover:bg-warning-600 hover:bg-gray-50 hover:text-warning-900' => $warning, | ||
'text-primary-700 dark:text-white dark:hover:bg-primary-600 hover:bg-gray-50 hover:text-primary-900' => $primary, | ||
'text-success-700 dark:text-white dark:hover:bg-success-600 hover:bg-gray-50 hover:text-success-900' => $success, | ||
'text-gray-700 dark:text-white dark:hover:bg-gray-600 hover:bg-gray-50 hover:text-gray-900' => $secondary, | ||
]) }} :method="$method"> | ||
<div class="flex justify-start gap-2"> | ||
@if($icon) | ||
<div class="flex flex-col justify-center items-center"> | ||
<i class="{{$icon}}"></i> | ||
</div> | ||
@endif | ||
<div> | ||
{{$label ?: $slot}} | ||
</div> | ||
</div> | ||
</x-splade-link> | ||
@else | ||
<button {{ $attributes->class([ | ||
'text-left w-full px-4 py-2 text-sm font-normal', | ||
'text-danger-700 dark:text-white dark:hover:bg-danger-600 hover:bg-gray-50 hover:text-danger-900' => $danger, | ||
'text-warning-700 dark:text-white dark:hover:bg-warning-600 hover:bg-gray-50 hover:text-warning-900' => $warning, | ||
'text-primary-700 dark:text-white dark:hover:bg-primary-600 hover:bg-gray-50 hover:text-primary-900' => $primary, | ||
'text-success-700 dark:text-white dark:hover:bg-success-600 hover:bg-gray-50 hover:text-success-900' => $success, | ||
'text-gray-700 dark:text-white dark:hover:bg-gray-600 hover:bg-gray-50 hover:text-gray-900' => $secondary, | ||
]) }}> | ||
<div class="flex justify-start gap-2"> | ||
@if($icon) | ||
<div class="flex flex-col justify-center items-center"> | ||
<i class="{{$icon}}"></i> | ||
</div> | ||
@endif | ||
<div> | ||
{{$label ?: $slot}} | ||
</div> | ||
</div> | ||
</button> | ||
@endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace TomatoPHP\TomatoAdmin\Views; | ||
|
||
use Illuminate\View\Component; | ||
|
||
class TableAction extends Component | ||
{ | ||
public ?bool $primary =false; | ||
|
||
public function __construct( | ||
public string $type='link', | ||
public ?string $label=null, | ||
public ?string $method="get", | ||
public ?string$icon=null, | ||
public ?bool $warning =false, | ||
public ?bool $secondary =false, | ||
public ?bool $danger =false, | ||
public ?bool $success =false, | ||
) | ||
{ | ||
$this->primary = !$this->warning && !$this->danger && !$this->success && !$this->secondary; | ||
} | ||
|
||
/** | ||
* Get the view / contents that represents the component. | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function render() | ||
{ | ||
return view('tomato-admin::components.table-action'); | ||
} | ||
} |