Skip to content

Commit ebcdff3

Browse files
Implement clear button functionality for bookmark search input
1 parent 3ede74a commit ebcdff3

File tree

3 files changed

+48
-31
lines changed

3 files changed

+48
-31
lines changed

src/entrypoints/popup/components/FolderSelector.vue

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="folder-selector">
33
<div class="form-group">
44
<label for="folder-search">{{ i18n.t('folder') }}</label>
5-
<div class="search-container">
5+
<div class="search-container input-with-clear">
66
<input
77
ref="folderInput"
88
id="folder-search"
@@ -355,35 +355,6 @@ onMounted(async () => {
355355
position: relative;
356356
}
357357
358-
.form-input.has-clear {
359-
padding-right: 32px;
360-
}
361-
362-
.clear-button {
363-
position: absolute;
364-
right: 8px;
365-
top: 50%;
366-
transform: translateY(-50%);
367-
width: 20px;
368-
height: 20px;
369-
border: none;
370-
background: var(--bg-tertiary);
371-
color: var(--text-secondary);
372-
border-radius: 50%;
373-
cursor: pointer;
374-
font-size: 14px;
375-
line-height: 1;
376-
display: flex;
377-
align-items: center;
378-
justify-content: center;
379-
transition: background-color 0.15s ease, color 0.15s ease;
380-
}
381-
382-
.clear-button:hover {
383-
background: var(--text-secondary);
384-
color: var(--bg-primary);
385-
}
386-
387358
.dropdown-header {
388359
display: flex;
389360
justify-content: space-between;

src/entrypoints/popup/components/SearchView.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,23 @@
2121
</div>
2222

2323
<div v-if="!error" class="filter-container">
24-
<div class="filter-input-wrapper">
24+
<div class="filter-input-wrapper input-with-clear">
2525
<input
2626
v-model="filterQuery"
2727
type="text"
2828
class="form-input"
29+
:class="{ 'has-clear': filterQuery }"
2930
:placeholder="selectedFolderId ? i18n.t('filterBookmarks') : i18n.t('searchAllBookmarks')"
3031
>
32+
<button
33+
v-if="filterQuery"
34+
type="button"
35+
class="clear-button"
36+
@mousedown.prevent="filterQuery = ''"
37+
:title="i18n.t('clearSelection')"
38+
>
39+
×
40+
</button>
3141
</div>
3242
<label class="fuzzy-toggle" @mousedown.prevent>
3343
<input

src/entrypoints/popup/style.css

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,3 +72,39 @@ body {
7272
.tab-label {
7373
user-select: none;
7474
}
75+
76+
/* Clear button for inputs */
77+
.input-with-clear {
78+
position: relative;
79+
}
80+
81+
.input-with-clear .form-input.has-clear {
82+
padding-right: 32px;
83+
}
84+
85+
.clear-button {
86+
position: absolute;
87+
right: 8px;
88+
top: 50%;
89+
transform: translateY(-50%);
90+
width: 20px;
91+
height: 20px;
92+
border: none;
93+
background: var(--bg-tertiary);
94+
color: var(--text-secondary);
95+
border-radius: 50%;
96+
cursor: pointer;
97+
font-size: 14px;
98+
line-height: 1;
99+
display: flex;
100+
align-items: center;
101+
justify-content: center;
102+
transition:
103+
background-color 0.15s ease,
104+
color 0.15s ease;
105+
}
106+
107+
.clear-button:hover {
108+
background: var(--text-secondary);
109+
color: var(--bg-primary);
110+
}

0 commit comments

Comments
 (0)