Skip to content

Commit dec010f

Browse files
authored
Merge pull request #1194 from livewire/josh/add-switch-left-align-attribute
Add switch `left-align` attribute
2 parents 8a519f3 + 60b123c commit dec010f

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

stubs/resources/views/flux/switch.blade.php

+14-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@props([
22
'name' => $attributes->whereStartsWith('wire:model')->first(),
3+
'align' => 'right',
34
])
45

56
@php
@@ -26,8 +27,16 @@
2627
]);
2728
@endphp
2829

29-
<flux:with-reversed-inline-field :$attributes>
30-
<ui-switch {{ $attributes->class($classes) }} data-flux-control data-flux-switch>
31-
<span class="{{ \Illuminate\Support\Arr::toCssClasses($indicatorClasses) }}"></span>
32-
</ui-switch>
33-
</flux:with-reversed-inline-field>
30+
@if ($align === 'left')
31+
<flux:with-inline-field :$attributes>
32+
<ui-switch {{ $attributes->class($classes) }} data-flux-control data-flux-switch>
33+
<span class="{{ \Illuminate\Support\Arr::toCssClasses($indicatorClasses) }}"></span>
34+
</ui-switch>
35+
</flux:with-inline-field>
36+
@else
37+
<flux:with-reversed-inline-field :$attributes>
38+
<ui-switch {{ $attributes->class($classes) }} data-flux-control data-flux-switch>
39+
<span class="{{ \Illuminate\Support\Arr::toCssClasses($indicatorClasses) }}"></span>
40+
</ui-switch>
41+
</flux:with-reversed-inline-field>
42+
@endif

0 commit comments

Comments
 (0)