Refactor form inputs and labels

This commit is contained in:
Andras Bacsai 2024-04-03 15:10:21 +02:00
parent 0b34207148
commit d31f75d1ec
4 changed files with 17 additions and 16 deletions

View File

@ -8,24 +8,25 @@
<div class="p-6 space-y-4 md:space-y-6 sm:p-8"> <div class="p-6 space-y-4 md:space-y-6 sm:p-8">
<form action="/login" method="POST" class="flex flex-col gap-2"> <form action="/login" method="POST" class="flex flex-col gap-2">
@csrf @csrf
{{-- @env('local') @env('local')
<x-forms.input value="test@example.com" type="email" name="email" required <x-forms.input value="test@example.com" type="email" autocomplete="email" name="email"
required label="{{ __('input.email') }}" autofocus />
<x-forms.input value="password" type="password" autocomplete="current-password" name="password"
required label="{{ __('input.password') }}" />
<a href="/forgot-password" class="text-xs">
{{ __('auth.forgot_password') }}?
</a>
@else
<x-forms.input type="email" name="email" autocomplete="email" required
label="{{ __('input.email') }}" autofocus /> label="{{ __('input.email') }}" autofocus />
<x-forms.input type="password" name="password" autocomplete="current-password" required
<x-forms.input value="password" type="password" name="password" required
label="{{ __('input.password') }}" /> label="{{ __('input.password') }}" />
<a href="/forgot-password" class="text-xs"> <a href="/forgot-password" class="text-xs">
{{ __('auth.forgot_password') }}? {{ __('auth.forgot_password') }}?
</a> </a>
@else --}} @endenv
<x-forms.input type="email" name="email" autocomplete="email" required label="{{ __('input.email') }}"
autofocus />
<x-forms.input type="password" name="password" autocomplete="current-password" required label="{{ __('input.password') }}" />
<a href="/forgot-password" class="text-xs">
{{ __('auth.forgot_password') }}?
</a>
{{-- @endenv --}}
<x-forms.button class="mt-10" type="submit">{{ __('auth.login') }}</x-forms.button> <x-forms.button class="mt-10" type="submit">{{ __('auth.login') }}</x-forms.button>
@if (!$is_registration_enabled) @if (!$is_registration_enabled)

View File

@ -3,7 +3,7 @@
'w-full' => !$isMultiline, 'w-full' => !$isMultiline,
])> ])>
@if ($label) @if ($label)
<label for="small-input" class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }} <label class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }}
@if ($required) @if ($required)
<x-highlighted text="*" /> <x-highlighted text="*" />
@endif @endif

View File

@ -1,6 +1,6 @@
<div class="w-full"> <div class="w-full">
@if ($label) @if ($label)
<label for="small-input" class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }} <label class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }}
@if ($required) @if ($required)
<x-highlighted text="*" /> <x-highlighted text="*" />
@endif @endif

View File

@ -1,6 +1,6 @@
<div class="flex-1 form-control"> <div class="flex-1 form-control">
@if ($label) @if ($label)
<label for="small-input" class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }} <label class="flex items-center gap-1 mb-1 text-sm font-medium">{{ $label }}
@if ($required) @if ($required)
<x-highlighted text="*" /> <x-highlighted text="*" />
@endif @endif