Skip to content

Commit f0b86b9

Browse files
feat(web): filter envelope search
1 parent d44eee3 commit f0b86b9

File tree

4 files changed

+166
-47
lines changed

4 files changed

+166
-47
lines changed

web/icons/icons.templ

+5
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,8 @@ templ ErrorWarning(class any) {
117117
templ Alert(class any) {
118118
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.865 3.00017L22.3912 19.5002C22.6674 19.9785 22.5035 20.5901 22.0252 20.8662C21.8732 20.954 21.7008 21.0002 21.5252 21.0002H2.47266C1.92037 21.0002 1.47266 20.5525 1.47266 20.0002C1.47266 19.8246 1.51886 19.6522 1.60663 19.5002L11.1329 3.00017C11.4091 2.52187 12.0206 2.358 12.4989 2.63414C12.651 2.72191 12.7772 2.84815 12.865 3.00017ZM4.20471 19.0002H19.7932L11.9989 5.50017L4.20471 19.0002ZM10.9989 16.0002H12.9989V18.0002H10.9989V16.0002ZM10.9989 9.00017H12.9989V14.0002H10.9989V9.00017Z"></path></svg>
119119
}
120+
121+
// https://remixicon.com/icon/filter-3-line
122+
templ Filter(class any) {
123+
<svg class={ class, "fill-current" } xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 18H14V16H10V18ZM3 6V8H21V6H3ZM6 13H18V11H6V13Z"></path></svg>
124+
}

web/icons/icons_templ.go

+39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/pages/envelope.templ

+32-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"github.com/ItsNotGoodName/smtpbridge/internal/models"
1212
"github.com/ItsNotGoodName/smtpbridge/web/helpers"
1313
"github.com/ItsNotGoodName/smtpbridge/web/icons"
14+
"strings"
1415
)
1516

1617
type envelopeViewProps struct {
@@ -94,14 +95,41 @@ templ envelopeListView(m meta.Meta, props envelopeListViewProps) {
9495
</div>
9596
<div class="flex flex-col gap-4 p-4">
9697
<div class="flex flex-col-reverse justify-between gap-4 sm:flex-row">
97-
<form class="join flex" action={ routes.EnvelopeList().URLString() }>
98+
<form class="flex gap-2" action={ routes.EnvelopeList().URLString() }>
9899
for k := range props.Query {
99-
if k != "search" {
100+
if !strings.HasPrefix(k, "search") {
100101
<input type="hidden" name={ k } value={ props.Query.Get(k) } />
101102
}
102103
}
103-
<input name="search" type="text" placeholder="Search" class="input input-sm input-bordered join-item w-full max-w-xs" value={ props.EnvelopeRequestRequest.Search } />
104-
<button title="Search" type="submit" class="btn btn-sm btn-primary join-item">@icons.Search("w-5 h-5")</button>
104+
<div class="join">
105+
<div class="dropdown join-item">
106+
<label tabindex="0" class="btn btn-sm join-item">
107+
@icons.Filter("w-5 h-5")
108+
</label>
109+
<ul tabindex="0" class="dropdown-content bg-base-100 rounded-box z-[1] w-52 p-2 shadow-lg">
110+
<li>
111+
<div class="form-control">
112+
<label class="label cursor-pointer">
113+
<span class="label-text">Subject</span>
114+
<input type="hidden" value="0" name="-search-subject" />
115+
<input name="search-subject" type="checkbox" class="checkbox" checked?={ props.EnvelopeRequestRequest.SearchSubject } />
116+
</label>
117+
</div>
118+
</li>
119+
<li>
120+
<div class="form-control">
121+
<label class="label cursor-pointer">
122+
<span class="label-text">Text</span>
123+
<input type="hidden" value="0" name="-search-text" />
124+
<input name="search-text" type="checkbox" class="checkbox" checked?={ props.EnvelopeRequestRequest.SearchText } />
125+
</label>
126+
</div>
127+
</li>
128+
</ul>
129+
</div>
130+
<input name="search" type="text" placeholder="Search" class="input input-sm input-bordered join-item w-full max-w-xs" value={ props.EnvelopeRequestRequest.Search } />
131+
<button title="Search" type="submit" class="btn btn-sm btn-primary join-item">@icons.Search("w-5 h-5")</button>
132+
</div>
105133
</form>
106134
<div class="join flex items-center justify-end" data-loading-states>
107135
<a title="Add" class="btn btn-sm join-item btn-success" href={ routes.EnvelopeCreate().URL() } data-loading-states>

0 commit comments

Comments
 (0)