dym-sh/resources/views/components/input.blade.php

58 lines
1.4 KiB
PHP
Raw Normal View History

2024-08-09 13:52:23 +02:00
@if( 'hidden' === $attributes['type'] )
2024-08-08 11:22:35 +02:00
<input
2024-08-09 13:52:23 +02:00
name="{{ $slot }}"
{{ $attributes->merge() }}
>
2024-08-11 11:53:49 +02:00
@elseif( 'checkbox' == $attributes['type'] )
<div class="x-input"
title="{{ $attributes['title'] ?? $slot }}"
>
<input type="checkbox" name="{{ $slug }}"
{{ $attributes['value'] ? 'checked="checked"' : '' }}
>
<label for={{ $slug }}></label>
</div>
2024-08-09 13:52:23 +02:00
@elseif( 'textarea' == $attributes['type'] )
<div class="x-input"
title="{{ $attributes['title'] ?? $slot }}"
>
<label
for="{{ $slot }}"
>{{ $attributes['title'] ?? $slot }}</label>
<textarea
name="{{ $slot }}"
id="{{ $slot }}"
placeholder="{{ $attributes['title'] ?? $slot }}"
{{ $attributes->merge()->filter(fn ($value, $key) => !in_array($key, ['title','value'])) }}
>{{ $attributes['value'] ?? '' }}</textarea>
@error( "$slot" )
<p class="error">{{ $message }}</p>
@enderror
</div>
@else
<div class="x-input"
title="{{ $attributes['title'] ?? $slot }}"
2024-08-08 11:22:35 +02:00
>
2024-08-09 13:52:23 +02:00
<label
for="{{ $slot }}"
>{{ $attributes['title'] ?? $slot }}</label>
<input
name="{{ $slot }}"
id="{{ $slot }}"
placeholder="{{ $attributes['title'] ?? $slot }}"
{{ $attributes->merge()->filter(fn ($value, $key) => !in_array($key, ['title'])) }}
>
2024-08-08 11:22:35 +02:00
2024-08-09 13:52:23 +02:00
@error( "$slot" )
<p class="error">{{ $message }}</p>
@enderror
</div>
2024-08-09 11:32:25 +02:00
@endif