Skip to content

Commit 581c908

Browse files
committed
Updated global search to use a window modal for better UX.
1 parent 6161062 commit 581c908

File tree

4 files changed

+75
-30
lines changed

4 files changed

+75
-30
lines changed

resources/views/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@
6868

6969
@stack('scripts')
7070

71-
71+
@include('platform::partials.search-modal')
7272
</body>
7373
</html>
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,30 @@
11
@forelse($results as $group)
22

33
@empty(!$group['label'])
4-
<div class="hidden-folded padder m-t-xs mb-1 text-muted small">{{$group['label']}}</div>
4+
<div class="hidden-folded text-muted small">{{$group['label']}}</div>
55
@endempty
66

77
@foreach($group['result'] as $item)
8-
<a href="{{$item->url()}}" class="block py-2 px-3 dropdown-item" style="font-size: 0.85em;">
8+
<div class="p-2 list-group-item-action d-flex gap-3 align-items-start position-relative rounded overflow-hidden">
99

1010
@empty(!$item->image())
11-
<span class="pull-left thumb-xs rounded me-3">
12-
<img src="{{$item->image()}}" alt="{{$item->title()}}">
13-
</span>
11+
<div class="thumb-sm rounded overflow-hidden">
12+
<img src="{{$item->image()}}" alt="{{$item->title()}}">
13+
</div>
1414
@endempty
1515

16-
<span class="clear">
17-
<span class="text-ellipsis">{{$item->title()}}</span>
18-
<small class="text-muted clear text-ellipsis">
19-
{{$item->subTitle()}}
20-
</small>
21-
</span>
22-
</a>
16+
<div class="d-flex flex-column">
17+
<div class="text-balance">
18+
<a href="{{ $item->url() }}"
19+
class="stretched-link link-offset-2 link-underline-opacity-25 link-underline-opacity-100-hover">
20+
{{$item->title()}}
21+
</a>
22+
</div>
23+
<div class="text-muted small text-balance">
24+
{{$item->subTitle()}}
25+
</div>
26+
</div>
27+
</div>
2328
@endforeach
2429

2530
@empty
@@ -32,12 +37,10 @@
3237

3338

3439
@if($total >= 5)
35-
3640
<a href="{{ route('platform.search', $query) }}" class="block py-2 px-3 dropdown-item border-top pb-1">
3741
<span class="small ps-1">
3842
{{ __('See more results.') }}
3943
<span class="text-muted">({{ $total }})</span>
4044
</span>
4145
</a>
42-
4346
@endif
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<div class="modal fade center-scale"
2+
tabindex="-1"
3+
role="dialog"
4+
id="search-modal"
5+
>
6+
<div class="modal-dialog modal-fullscreen-md-down" role="document">
7+
<div class="modal-content">
8+
9+
<div class="modal-header align-items-baseline gap-3">
10+
<h4 class="modal-title text-body-emphasis fw-light text-balance text-break"
11+
data-modal-target="title">
12+
{{ __('Search') }}
13+
</h4>
14+
<button type="button" class="btn-close" title="Close" data-bs-dismiss="modal"
15+
aria-label="Close">
16+
</button>
17+
</div>
18+
19+
<div class="modal-body p-4 py-4">
20+
<div data-controller="search-docs">
21+
<div class="position-relative d-flex flex-column gap-3" data-controller="search">
22+
<div class="input-icon">
23+
<input
24+
data-action="keyup->search#query blur->search#blur focus->search#focus"
25+
data-search-target="query"
26+
autocomplete="off"
27+
autofocus
28+
type="text"
29+
value="@yield('search')"
30+
class="form-control"
31+
placeholder="{{ __('What to search...') }}"
32+
>
33+
<div class="input-icon-addon">
34+
<x-orchid-icon path="bs.search"/>
35+
</div>
36+
</div>
37+
<div id="search-result"
38+
class="d-flex flex-column gap-2 list-group">
39+
</div>
40+
</div>
41+
</div>
42+
43+
</div>
44+
</div>
45+
</div>
46+
</div>
Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,21 @@
1-
@empty(!Dashboard::getSearch()->all())
1+
@if(Dashboard::getSearch()->isNotEmpty())
22
<div class="p-3">
3-
<div class="dropdown position-relative" data-controller="search">
3+
<div class="position-relative overflow-hidden">
44
<div class="input-icon">
5-
<input
6-
data-action="keyup->search#query blur->search#blur focus->search#focus"
7-
data-search-target="query"
8-
type="text"
9-
value="@yield('search')"
10-
class="form-control input-sm padder bg-dark text-white"
11-
placeholder="{{ __('What to search...') }}"
12-
>
5+
<input class="form-control bg-dark text-white"
6+
type="text"
7+
readonly
8+
placeholder="{{ __('What to search...') }}">
139
<div class="input-icon-addon">
1410
<x-orchid-icon path="bs.search"/>
1511
</div>
1612
</div>
17-
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow bg-white w-100"
18-
x-placement="start-left" id="search-result">
19-
</div>
13+
<a href="#"
14+
data-bs-toggle="modal"
15+
data-bs-target="#search-modal"
16+
class="stretched-link"></a>
2017
</div>
2118
</div>
22-
2319
@else
2420
<div class="divider my-2"></div>
25-
@endempty
21+
@endif

0 commit comments

Comments
 (0)