mirror of
https://github.com/He4eT/tabswitcher.git
synced 2026-05-05 01:17:23 +00:00
pages/search: markup
This commit is contained in:
parent
3f644ee959
commit
2ace4fdd93
4 changed files with 46 additions and 34 deletions
|
|
@ -1,5 +1,22 @@
|
|||
const tabView = (tab) =>
|
||||
`<button class='tab'>${tab.displayName}</button>`
|
||||
const fuzzysort = window.fuzzysort
|
||||
|
||||
/* https://png-pixel.com/ */
|
||||
const defaultFavicon = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkqAcAAIUAgUW0RjgAAAAASUVORK5CYII='
|
||||
|
||||
const tabView = (result) => {
|
||||
const tab = result.obj
|
||||
const [label, title, url] =
|
||||
result.map((field) => fuzzysort.highlight(field))
|
||||
|
||||
return `
|
||||
<button class='tab' data-id='${tab.id}'>
|
||||
<span class='label'>${label ?? tab.label}</span>
|
||||
<img class='favicon' src='${tab.favIconUrl ?? defaultFavicon}'/>
|
||||
<span class='title'>${title ?? tab.title}</span>
|
||||
<span class='url'>${url ?? tab.url}</span>
|
||||
</button>
|
||||
`
|
||||
}
|
||||
|
||||
export const updateSearchResults = (state) => {
|
||||
const container = document.getElementById('searchResults')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue