Skip to content

Commit e3f3a1e

Browse files
committed
Deleting clear button as unnecessary
1 parent 78b92ca commit e3f3a1e

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

src/components/overrides/Sidebar.astro

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
2222
type="text"
2323
id="sidebar-search"
2424
placeholder="Search documentation..."
25-
class="w-full px-3 pr-8 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-orange-500 dark:focus:border-orange-500 transition-colors duration-200"
25+
class="w-full px-3 py-2 text-sm border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder-gray-500 dark:placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-orange-500 dark:focus:border-orange-500 transition-colors duration-200"
2626
/>
27-
<button
28-
id="sidebar-search-clear"
29-
class="absolute right-2 top-1/2 transform -translate-y-1/2 bg-transparent border-none text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 cursor-pointer text-xl leading-none p-1 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-200"
30-
>×</button>
3127
</div>
3228

3329
<!-- No Results Message -->
@@ -43,7 +39,6 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
4339
<script>
4440
function initSidebarSearch() {
4541
const searchInput = document.getElementById('sidebar-search') as HTMLInputElement;
46-
const clearButton = document.getElementById('sidebar-search-clear') as HTMLButtonElement;
4742
const noResultsMessage = document.getElementById('sidebar-no-results') as HTMLElement;
4843
const globalSearchLink = document.getElementById('global-search-link') as HTMLButtonElement;
4944
const sidebarContent = document.querySelector('.sidebar-content');
@@ -117,12 +112,9 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
117112
// Hide no results message
118113
noResultsMessage.classList.add('hidden');
119114

120-
clearButton.style.display = 'none';
121115
return;
122116
}
123117

124-
clearButton.style.display = 'block';
125-
126118
// Split search query into terms for more precise matching
127119
const searchTerms = query.toLowerCase().split(/\s+/).filter(term => term.length > 0);
128120

@@ -224,12 +216,6 @@ const [product, module] = Astro.url.pathname.split("/").filter(Boolean);
224216
filterSidebarItems(query);
225217
});
226218

227-
clearButton.addEventListener('click', () => {
228-
searchInput.value = '';
229-
filterSidebarItems('');
230-
searchInput.focus();
231-
});
232-
233219
// Clear search on Escape key
234220
searchInput.addEventListener('keydown', (e) => {
235221
if (e.key === 'Escape') {

0 commit comments

Comments
 (0)