Skip to content
This repository was archived by the owner on Oct 1, 2021. It is now read-only.

Commit 3261e11

Browse files
authored
refactor: use conditional classes for input includes (#652)
1 parent 5e89bf2 commit 3261e11

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

resources/views/inputs/includes/input-error-tooltip.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
<button
88
type="button"
99
wire:key="{{ md5($id.$error) }}"
10-
class="px-4 input-icon @if($shifted) right-13 @else right-0 @endif focus-visible:rounded"
10+
@class([
11+
'px-4 input-icon focus-visible:rounded',
12+
'right-13' => $shifted,
13+
'right-0' => ! $shifted,
14+
])
1115
data-tippy-content="{{ $error }}"
1216
onclick="document.getElementById('{{ $id }}').focus()"
1317
>

resources/views/inputs/includes/input-label.blade.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212

1313
<label
1414
for="{{ $id ?? $name }}"
15-
class="items-center input-label @error($name) input-label--error @enderror"
15+
@class([
16+
'items-center input-label',
17+
'input-label--error' => $errors->has($name),
18+
])
1619
>
1720
{{ $label ? $label : trans('forms.' . $name) }}
1821

resources/views/inputs/includes/tile-selection-option.blade.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ class="flex relative flex-col"
1111
dusk="tile-selection-label-{{ $option['id'] }}"
1212
for="{{ $id.'-'.$option['id'] }}"
1313
wire:key="tile-selection-option-{{ $id.'-'.$option['id'] }}"
14-
class="{{ $single ? 'tile-selection-single' : 'tile-selection-option' }} {{ $isDisabled && ! $option['checked'] ? 'disabled-tile' : '' }}"
14+
@class([
15+
'tile-selection-single' => $single,
16+
'tile-selection-option' => ! $single,
17+
'disabled-tile' => $isDisabled && ! $option['checked'],
18+
])
1519
x-bind:class="{
1620
@if ($single)
1721
'tile-selection--checked': {{ $this->{$wireModel ?? $id} === $option['id'] ? 'true': 'false' }},

0 commit comments

Comments
 (0)