Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 committed Jun 20, 2024
1 parent e5ed07a commit 3d0ed97
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 16 deletions.
4 changes: 4 additions & 0 deletions resources/css/presets/tailwind.config.preset.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import colors from 'tailwindcss/colors';
import forms from '@tailwindcss/forms';
import typography from '@tailwindcss/typography';

Expand All @@ -7,6 +8,9 @@ export default {
plugins: [forms, typography],
theme: {
extend: {
colors: {
primary: colors.slate,
},
container: {
center: true,
padding: '2rem',
Expand Down
6 changes: 5 additions & 1 deletion resources/views/actions/button.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
<button {{ $attributes
->cssClass([
'layer' => 'flex shrink-0 cursor-pointer items-center justify-center',
'label' => 'text-sm',
'label' => 'text-inherit',
'primary' => 'py-1.5 px-3 bg-primary-500 rounded border border-primary-500',
'active' => 'text-primary-400 hover:text-primary-300',
'inactive' => 'text-secondary-400 hover:text-primary-400',
'icon' => 'size-6 text-secondary-400',
])
->mergeAttributes($action->getComponentAttributes())
->classMerge([
'layer',
'primary' => $attributes->get('type') === 'submit',
'active' => $isCurrent(),
'inactive' => ! $isCurrent(),
])
->merge([
'type' => 'button',
Expand Down
8 changes: 5 additions & 3 deletions resources/views/actions/link.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
class:icon="{{ $attributes->classFor('icon') }}"
/>

<span class="{{ $attributes->classFor('label') }}">
{{ $label() }}
</span>
@if ($action->hasLabel())
<span class="{{ $attributes->classFor('label') }}">
{{ $label() }}
</span>
@endif
@else
{{ $slot }}
@endif
Expand Down
13 changes: 1 addition & 12 deletions src/Actions/Components/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,12 @@
namespace Foxws\WireUse\Actions\Components;

use Closure;
use Foxws\WireUse\Actions\Support\Action;
use Foxws\WireUse\Views\Support\Component;
use Illuminate\View\View;

class Button extends Component
class Button extends Link
{
public function __construct(
public Action $action,
) {}

public function render(): View|Closure|string
{
return view('wireuse::actions.button');
}

public function label(): ?string
{
return $this->action->getLabel() ?: $this->action->getName();
}
}

0 comments on commit 3d0ed97

Please sign in to comment.