[UI docs] Added filter bar for integrations and events.

This commit is contained in:
Fabio Manganiello 2024-05-17 02:21:32 +02:00
parent f06233801b
commit 3d5c60e4f4
Signed by: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 96 additions and 4 deletions
docs/source/_static/scripts

View file

@ -188,9 +188,47 @@ const renderActionsList = () => {
})
}
const addFilterBar = () => {
const container = document.querySelector('.bd-main')
if (!container)
return
const referenceSection = document.getElementById('reference')
if (!referenceSection)
return
const header = referenceSection.querySelector('h2')
if (!header)
return
const input = document.createElement('input')
input.type = 'text'
input.placeholder = 'Filter'
input.classList.add('filter-bar')
input.addEventListener('input', (event) => {
const filter = event.target.value.toLowerCase()
referenceSection.querySelectorAll('ul.grid li').forEach((li) => {
if (li.innerText.toLowerCase().includes(filter)) {
li.style.display = 'flex'
} else {
li.style.display = 'none'
}
})
})
// Apply the fixed class if the header is above the viewport
const headerOffsetTop = header.offsetTop
document.addEventListener('scroll', () => {
header.classList.toggle('fixed', headerOffsetTop < window.scrollY)
})
header.appendChild(input)
}
document.addEventListener("DOMContentLoaded", function() {
generateComponentsGrid()
convertDepsToTabs()
addClipboardToCodeBlocks()
renderActionsList()
addFilterBar()
})