Improved input size consistency

Specifically updates dropdown search and user-search implementation,
although does affect all inputs.
Decouples breadcrum and select-style dropdown search toggles.

Addresses #2678
This commit is contained in:
Dan Brown 2022-05-14 16:05:29 +01:00
parent 9fda0df798
commit d20c74babf
No known key found for this signature in database
GPG Key ID: 46D9F943C24A2EF9
9 changed files with 99 additions and 67 deletions

View File

@ -731,6 +731,55 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
} }
} }
.dropdown-search {
position: relative;
}
.dropdown-search-toggle-breadcrumb {
border: 1px solid transparent;
border-radius: 4px;
line-height: normal;
padding: $-xs;
&:hover {
border-color: #DDD;
}
.svg-icon {
margin-inline-end: 0;
}
}
.dropdown-search-toggle-select {
display: flex;
gap: $-s;
line-height: normal;
.svg-icon {
height: 16px;
margin: 0;
}
.avatar {
height: 22px;
width: 22px;
}
.avatar + span {
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dropdown-search-toggle-caret {
font-size: 1.15rem;
}
}
.dropdown-search-toggle-select-label {
min-width: 0;
white-space: nowrap;
}
.dropdown-search-toggle-select-caret {
font-size: 1.5rem;
line-height: 0;
margin-left: auto;
margin-top: -2px;
}
.dropdown-search-dropdown { .dropdown-search-dropdown {
box-shadow: $bs-med; box-shadow: $bs-med;
overflow: hidden; overflow: hidden;
@ -790,9 +839,3 @@ body.flexbox-support #entity-selector-wrap .popup-body .form-group {
max-height: 240px; max-height: 240px;
} }
} }
.custom-select-input {
max-width: 280px;
border: 1px solid #D4D4D4;
border-radius: 3px;
}

View File

@ -7,7 +7,8 @@
@include lightDark(color, #666, #AAA); @include lightDark(color, #666, #AAA);
display: inline-block; display: inline-block;
font-size: $fs-m; font-size: $fs-m;
padding: $-xs*1.5; padding: $-xs*1.8;
height: 40px;
width: 250px; width: 250px;
max-width: 100%; max-width: 100%;
@ -373,6 +374,7 @@ input[type=color] {
max-width: 840px; max-width: 840px;
margin: 0 auto; margin: 0 auto;
border: none; border: none;
height: auto;
} }
} }
@ -413,9 +415,11 @@ div[editor-type="markdown"] .title-input.page-title input[type="text"] {
} }
input { input {
display: block; display: block;
padding: $-xs * 1.5;
padding-inline-start: $-l + 4px; padding-inline-start: $-l + 4px;
width: 300px; width: 300px;
max-width: 100%; max-width: 100%;
height: auto;
} }
&.flexible input { &.flexible input {
width: 100%; width: 100%;

View File

@ -86,6 +86,8 @@ header .search-box {
border-radius: 40px; border-radius: 40px;
color: #EEE; color: #EEE;
z-index: 2; z-index: 2;
height: auto;
padding: $-xs*1.5;
padding-inline-start: 40px; padding-inline-start: 40px;
&:focus { &:focus {
outline: none; outline: none;
@ -279,29 +281,6 @@ header .search-box {
} }
} }
.dropdown-search {
position: relative;
.dropdown-search-toggle {
padding: $-xs;
border: 1px solid transparent;
border-radius: 4px;
&:hover {
border-color: #DDD;
}
}
.svg-icon {
margin-inline-end: 0;
}
}
.dropdown-search-toggle.compact {
padding: $-xxs $-xs;
.avatar {
height: 22px;
width: 22px;
}
}
.faded { .faded {
a, button, span, span > div { a, button, span, span > div {
color: #666; color: #666;

View File

@ -155,6 +155,13 @@ body.flexbox {
} }
} }
.gap-m {
gap: $-m;
}
.justify-flex-start {
justify-content: flex-start;
}
.justify-flex-end { .justify-flex-end {
justify-content: flex-end; justify-content: flex-end;
} }

View File

@ -2,7 +2,7 @@
option:dropdown-search:url="/search/entity/siblings?entity_type={{$entity->getType()}}&entity_id={{ $entity->id }}" option:dropdown-search:url="/search/entity/siblings?entity_type={{$entity->getType()}}&entity_id={{ $entity->id }}"
option:dropdown-search:local-search-selector=".entity-list-item" option:dropdown-search:local-search-selector=".entity-list-item"
> >
<div class="dropdown-search-toggle" refs="dropdown@toggle" <div class="dropdown-search-toggle-breadcrumb" refs="dropdown@toggle"
aria-haspopup="true" aria-expanded="false" tabindex="0"> aria-haspopup="true" aria-expanded="false" tabindex="0">
<div class="separator">@icon('chevron-right')</div> <div class="separator">@icon('chevron-right')</div>
</div> </div>

View File

@ -15,7 +15,7 @@
<div> <div>
<div class="form-group"> <div class="form-group">
<label for="owner">{{ trans('entities.permissions_owner') }}</label> <label for="owner">{{ trans('entities.permissions_owner') }}</label>
@include('form.user-select', ['user' => $model->ownedBy, 'name' => 'owned_by', 'compact' => false]) @include('form.user-select', ['user' => $model->ownedBy, 'name' => 'owned_by'])
</div> </div>
</div> </div>
</div> </div>

View File

@ -1,19 +1,19 @@
<div class="dropdown-search custom-select-input" components="dropdown dropdown-search user-select" <div class="dropdown-search" components="dropdown dropdown-search user-select"
option:dropdown-search:url="/search/users/select" option:dropdown-search:url="/search/users/select"
> >
<input refs="user-select@input" type="hidden" name="{{ $name }}" value="{{ $user->id ?? '' }}"> <input refs="user-select@input" type="hidden" name="{{ $name }}" value="{{ $user->id ?? '' }}">
<div refs="dropdown@toggle" <div refs="dropdown@toggle"
class="dropdown-search-toggle {{ $compact ? 'compact' : '' }} flex-container-row items-center" class="dropdown-search-toggle-select input-base"
aria-haspopup="true" aria-expanded="false" tabindex="0"> aria-haspopup="true" aria-expanded="false" tabindex="0">
<div refs="user-select@user-info" class="flex-container-row items-center px-s"> <div refs="user-select@user-info" class="dropdown-search-toggle-select-label flex-container-row items-center">
@if($user) @if($user)
<img class="avatar small mr-m" src="{{ $user->getAvatar($compact ? 22 : 30) }}" alt="{{ $user->name }}"> <img class="avatar small mr-m" src="{{ $user->getAvatar(30) }}" width="30" height="30" alt="{{ $user->name }}">
<span>{{ $user->name }}</span> <span>{{ $user->name }}</span>
@else @else
<span>{{ trans('settings.users_none_selected') }}</span> <span>{{ trans('settings.users_none_selected') }}</span>
@endif @endif
</div> </div>
<span style="font-size: {{ $compact ? '1.15rem' : '1.5rem' }}; margin-left: auto;"> <span class="dropdown-search-toggle-select-caret">
@icon('caret-down') @icon('caret-down')
</span> </span>
</div> </div>

View File

@ -9,8 +9,9 @@
<h1 class="list-heading">{{ trans('settings.audit') }}</h1> <h1 class="list-heading">{{ trans('settings.audit') }}</h1>
<p class="text-muted">{{ trans('settings.audit_desc') }}</p> <p class="text-muted">{{ trans('settings.audit_desc') }}</p>
<div class="flex-container-row"> <form action="{{ url('/settings/audit') }}" method="get" class="flex-container-row wrap justify-flex-start gap-m">
<div component="dropdown" class="list-sort-type dropdown-container mr-m">
<div component="dropdown" class="list-sort-type dropdown-container">
<label for="">{{ trans('settings.audit_event_filter') }}</label> <label for="">{{ trans('settings.audit_event_filter') }}</label>
<button refs="dropdown@toggle" aria-haspopup="true" aria-expanded="false" aria-label="{{ trans('common.sort_options') }}" class="input-base text-left">{{ $listDetails['event'] ?: trans('settings.audit_event_filter_no_filter') }}</button> <button refs="dropdown@toggle" aria-haspopup="true" aria-expanded="false" aria-label="{{ trans('common.sort_options') }}" class="input-base text-left">{{ $listDetails['event'] ?: trans('settings.audit_event_filter_no_filter') }}</button>
<ul refs="dropdown@menu" class="dropdown-menu"> <ul refs="dropdown@menu" class="dropdown-menu">
@ -21,13 +22,12 @@
</ul> </ul>
</div> </div>
<form action="{{ url('/settings/audit') }}" method="get" class="flex-container-row mr-m">
@if(!empty($listDetails['event'])) @if(!empty($listDetails['event']))
<input type="hidden" name="event" value="{{ $listDetails['event'] }}"> <input type="hidden" name="event" value="{{ $listDetails['event'] }}">
@endif @endif
@foreach(['date_from', 'date_to'] as $filterKey) @foreach(['date_from', 'date_to'] as $filterKey)
<div class="mr-m"> <div class=>
<label for="audit_filter_{{ $filterKey }}">{{ trans('settings.audit_' . $filterKey) }}</label> <label for="audit_filter_{{ $filterKey }}">{{ trans('settings.audit_' . $filterKey) }}</label>
<input id="audit_filter_{{ $filterKey }}" <input id="audit_filter_{{ $filterKey }}"
component="submit-on-change" component="submit-on-change"
@ -37,21 +37,20 @@
</div> </div>
@endforeach @endforeach
<div class="form-group ml-auto mr-m" <div class="form-group"
component="submit-on-change" component="submit-on-change"
option:submit-on-change:filter='[name="user"]'> option:submit-on-change:filter='[name="user"]'>
<label for="owner">{{ trans('settings.audit_table_user') }}</label> <label for="owner">{{ trans('settings.audit_table_user') }}</label>
@include('form.user-select', ['user' => $listDetails['user'] ? \BookStack\Auth\User::query()->find($listDetails['user']) : null, 'name' => 'user', 'compact' => true]) @include('form.user-select', ['user' => $listDetails['user'] ? \BookStack\Auth\User::query()->find($listDetails['user']) : null, 'name' => 'user'])
</div> </div>
<div class="form-group ml-auto"> <div class="form-group">
<label for="ip">{{ trans('settings.audit_table_ip') }}</label> <label for="ip">{{ trans('settings.audit_table_ip') }}</label>
@include('form.text', ['name' => 'ip', 'model' => (object) $listDetails]) @include('form.text', ['name' => 'ip', 'model' => (object) $listDetails])
<input type="submit" style="display: none"> <input type="submit" style="display: none">
</div> </div>
</form> </form>
</div>
<hr class="mt-l mb-s"> <hr class="mt-l mb-s">

View File

@ -19,7 +19,7 @@
<p class="small">{{ trans('settings.users_migrate_ownership_desc') }}</p> <p class="small">{{ trans('settings.users_migrate_ownership_desc') }}</p>
</div> </div>
<div> <div>
@include('form.user-select', ['name' => 'new_owner_id', 'user' => null, 'compact' => false]) @include('form.user-select', ['name' => 'new_owner_id', 'user' => null])
</div> </div>
</div> </div>
@endif @endif