Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added “data-variant” attribute to components #407

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ composer.lock
.phpunit.result.cache
node_modules/**
test-results/**
.idea
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

78 changes: 78 additions & 0 deletions .idea/flux.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/phpspec.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions stubs/resources/views/flux/button-or-link.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@props([
'type' => 'button',
'variant' => null,
'current' => null,
'href' => null,
])
Expand All @@ -18,11 +19,11 @@

<?php if ($href): ?>
{{-- We are using e() here to escape the href attribute value instead of "{{ }}" because the latter will escape the entire attribute value, including the "&" character... --}}
<a href="{!! e($href) !!}" {{ $attributes->merge(['data-current' => $current]) }}>
<a href="{!! e($href) !!}" {{ $attributes->merge(['data-current' => $current, 'data-variant' => $variant]) }}>
{{ $slot }}
</a>
<?php else: ?>
<button {{ $attributes->merge(['type' => $type, 'data-current' => $current]) }}>
<button {{ $attributes->merge(['type' => $type, 'data-current' => $current, 'data-variant' => $variant]) }}>
{{ $slot }}
</button>
<?php endif; ?>
2 changes: 1 addition & 1 deletion stubs/resources/views/flux/button/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
@endphp

<flux:with-tooltip :$attributes>
<flux:button-or-link :$type :attributes="$attributes->class($classes)" data-flux-button>
<flux:button-or-link :$type :$variant :attributes="$attributes->class($classes)" data-flux-button>
<?php if ($loading): ?>
<div class="absolute inset-0 flex items-center justify-center opacity-0" data-flux-loading-indicator>
<flux:icon icon="loading" :variant="$iconVariant" />
Expand Down
2 changes: 1 addition & 1 deletion stubs/resources/views/flux/menu/checkbox/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
;
@endphp

<ui-menu-checkbox {{ $attributes->class($classes) }} data-flux-menu-item-has-icon data-flux-menu-checkbox>
<ui-menu-checkbox {{ $attributes->class($classes) }} data-flux-menu-item-has-icon data-flux-menu-checkbox data-variant="{{ $variant }}">
<div class="w-7">
<div class="hidden group-data-[checked]/menu-checkbox:block">
<flux:icon variant="mini" icon="check" data-flux-menu-item-icon />
Expand Down
2 changes: 1 addition & 1 deletion stubs/resources/views/flux/menu/item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
;
@endphp

<flux:button-or-link :attributes="$attributes->class($classes)" data-flux-menu-item :data-flux-menu-item-has-icon="!! $icon">
<flux:button-or-link :$variant :attributes="$attributes->class($classes)" data-flux-menu-item :data-flux-menu-item-has-icon="!! $icon">
<?php if ($icon): ?>
<flux:icon :$icon variant="mini" class="mr-2" data-flux-menu-item-icon />
<?php else: ?>
Expand Down
2 changes: 1 addition & 1 deletion stubs/resources/views/flux/menu/radio/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
;
@endphp

<ui-menu-radio {{ $attributes->class($classes) }} data-flux-menu-item-has-icon data-flux-menu-radio>
<ui-menu-radio {{ $attributes->class($classes) }} data-flux-menu-item-has-icon data-flux-menu-radio data-variant="{{ $variant }}">
<div class="w-7">
<div class="hidden group-data-[checked]/menu-radio:block">
<flux:icon variant="mini" icon="check" data-flux-menu-item-icon />
Expand Down
2 changes: 1 addition & 1 deletion stubs/resources/views/flux/navmenu/item.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
;
@endphp

<flux:button-or-link :attributes="$attributes->class($classes)" data-flux-navmenu-item>
<flux:button-or-link :$variant :attributes="$attributes->class($classes)" data-flux-navmenu-item>
<?php if ($indent): ?>
<div class="w-7"></div>
<?php endif; ?>
Expand Down
4 changes: 2 additions & 2 deletions stubs/resources/views/flux/separator.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
@endphp

<?php if ($text): ?>
<div data-orientation="{{ $orientation }}" class="flex items-center w-full" role="none" data-flux-separator>
<div data-orientation="{{ $orientation }}" class="flex items-center w-full" role="none" data-flux-separator data-variant="{{ $variant }}">
<div {{ $attributes->class([$classes, 'grow']) }}></div>

<span class="shrink mx-6 font-medium text-sm text-zinc-500 dark:text-zinc-300 whitespace-nowrap">{{ $text }}</span>

<div {{ $attributes->class([$classes, 'grow']) }}></div>
</div>
<?php else: ?>
<div data-orientation="{{ $orientation }}" role="none" {{ $attributes->class($classes, 'shrink-0') }} data-flux-separator></div>
<div data-orientation="{{ $orientation }}" role="none" {{ $attributes->class($classes, 'shrink-0') }} data-flux-separator data-variant="{{ $variant }}"></div>
<?php endif; ?>