Skip to content

Commit

Permalink
Layout Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulabs committed Dec 13, 2024
1 parent aeeaf73 commit c119f0f
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 50 deletions.
4 changes: 2 additions & 2 deletions resources/views/bootstrap-5/form-errors.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@error($name, $bag)
<div {!! $attributes->merge(['class' => 'invalid-feedback']) !!}>
{{ $message }}
{!! $message !!}
</div>
@enderror
@enderror
6 changes: 3 additions & 3 deletions resources/views/bootstrap-5/form-group.blade.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div {!! $attributes->merge(['class' => ($hasError($name) ? 'is-invalid' : '')]) !!}>
<x-form-label :label="$label" />
<div {!! $attributes->merge(['class' => ($hasError($name) ? 'is-invalid mb-4' : 'mb-4')]) !!}>
<x-form-label :label="$label" :icon1="$attributes->get('icon1') ?? null" :icon2="$attributes->get('icon2') ?? null"/>

<div class="@if($inline) d-flex flex-row flex-wrap inline-space @endif">
<div class="w-fit @if($inline) d-flex flex-row flex-wrap inline-space @endif">
{!! $slot !!}
</div>

Expand Down
14 changes: 9 additions & 5 deletions resources/views/bootstrap-5/form-input.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
@if($type === 'hidden') <div class="d-none"> @endif
@if($floating) <div class="form-floating"> @endif
@if($floating) <div class="mb-3 form-floating"> @endif

@if(!$floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif

<input
{!! $attributes->merge(['class' => 'form-control' . ($type === 'color' ? ' form-control-color' : '') . ($hasError($name) ? ' is-invalid' : '')]) !!}

autocomplete="off"
type="{{ $type }}"

@if($isWired())
Expand All @@ -31,12 +31,16 @@
@if($floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif
{!! $help ?? null !!}
@if($floating)
@if($hasErrorAndShow($name))
<x-form-errors :name="$name" />
@endif
</div> @endif

@if($floating) </div> @endif

{!! $help ?? null !!}

@if($hasErrorAndShow($name))
@if(!$floating && $hasErrorAndShow($name))
<x-form-errors :name="$name" />
@endif

Expand Down
18 changes: 16 additions & 2 deletions resources/views/bootstrap-5/form-label.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
@if($label)
<label {!! $attributes !!}>{{ $label }}</label>
@endif
@if($attributes->get('icon1') ?? null || $attributes->get('icon2') ?? null)
<div class="d-inline-flex align-items-center w-100 justify-content-between gap-5">
<label {!! $attributes !!} class="form-label">{!! $label !!}</label>
<div class="tool_icons d-flex gap-3">
@if($attributes->get('icon1') ?? null)
<button type="button" data-bs-html="true" class="btn btn-sm btn-success" data-bs-toggle="tooltip" data-bs-title="{!! $attributes->get('icon1') !!}" data-bs-custom-class="custom-tooltip">i</button>
@endif
@if($attributes->get('icon2') ?? null)
<button type="button" data-bs-html="true" data-bs-toggle="tooltip" data-bs-title="{!! $attributes->get('icon2') !!}" class="btn btn-sm btn-danger" data-bs-custom-class="custom-tooltip">§</button>
@endif
</div>
</div>
@else
<label {!! $attributes !!} class="form-label">{!! $label !!}</label>
@endif
@endif
10 changes: 2 additions & 8 deletions resources/views/bootstrap-5/form-radio.blade.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<div class="form-check @if(null !== $attributes->get('inline')) form-check-inline @endif">
<input
{!! $attributes->merge(['class' => 'form-check-input' . ($hasError($name) ? ' is-invalid' : '')]) !!}

type="radio"

value="{{ $value }}"
{!! $attributes->merge(['class' => 'form-check-input' . ($hasError($name) ? ' is-invalid' : '')]) !!} type="radio" value="{{ $value }}"

@if($isWired())
wire:model{!! $wireModifier() !!}="{{ $name }}"
Expand All @@ -20,9 +16,7 @@
checked="checked"
@endif
/>

<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" class="form-check-label" />

<x-form-label :icon1="$attributes->get('icon1') ?? null" :icon2="$attributes->get('icon2') ?? null" :label="$label" :for="$attributes->get('id') ?: $id()" class="form-check-label" />
{!! $help ?? null !!}

@if($hasErrorAndShow($name))
Expand Down
16 changes: 10 additions & 6 deletions resources/views/bootstrap-5/form-select.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@if($floating) <div class="form-floating"> @endif
@if($floating) <div class="mb-3 form-floating"> @endif

@if(!$floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
Expand Down Expand Up @@ -27,7 +27,7 @@
>

@if($placeholder)
<option value="" disabled @if($nothingSelected()) selected="selected" @endif>
<option value="" @if($nothingSelected()) selected="selected" @endif>
{{ $placeholder }}
</option>
@endif
Expand All @@ -40,15 +40,19 @@
{!! $slot !!}
@endforelse
</select>

{!! $help ?? null !!}
@if($floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif

@if($floating) </div> @endif
@if($floating)
@if($hasErrorAndShow($name))
<x-form-errors :name="$name" />
@endif
</div> @endif


{!! $help ?? null !!}

@if($hasErrorAndShow($name))
@if(!$floating && $hasErrorAndShow($name))
<x-form-errors :name="$name" />
@endif
47 changes: 23 additions & 24 deletions resources/views/bootstrap-5/form-textarea.blade.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
@if($floating) <div class="form-floating"> @endif
<div >
@if($floating) <div class="form-floating mb-3"> @endif

@if(!$floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif
@if(!$floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif

<textarea
@if($isWired())
<textarea
@if($isWired())
wire:model{!! $wireModifier() !!}="{{ $name }}"
@endif
@endif

name="{{ $name }}"
name="{{ $name }}"

@if($label && !$attributes->get('id'))
@if($label && !$attributes->get('id'))
id="{{ $id() }}"
@endif
@endif

{{-- Placeholder is required as of writing --}}
@if($floating && !$attributes->get('placeholder'))
{{-- Placeholder is required as of writing --}}
@if($floating && !$attributes->get('placeholder'))
placeholder="&nbsp;"
@endif

{!! $attributes->merge(['class' => 'form-control' . ($hasError($name) ? ' is-invalid' : '')]) !!}
{!! $attributes->merge(['class' => 'form-control' . ($hasError($name) ? ' is-invalid' : '')]) !!}
>@unless($isWired()){!! $value !!}@endunless</textarea>

@if($floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif

@if($floating) </div> @endif

{!! $help ?? null !!}

@if($hasErrorAndShow($name))
<x-form-errors :name="$name" />
@endif
@if($floating)
<x-form-label :label="$label" :for="$attributes->get('id') ?: $id()" />
@endif
{!! $help ?? null !!}
@if($hasErrorAndShow($name))
<x-form-errors :name="$name" />
@endif
@if($floating) </div> @endif
</div>

0 comments on commit c119f0f

Please sign in to comment.