Skip to content

Commit

Permalink
Normalize queries and tweak presentation of the palette
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Feb 29, 2024
1 parent 345ca6c commit 39f6307
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/components/Palette/integrations/items.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,16 @@ function ItemRow ({ item }) {
* @returns
*/
async function getItems (query) {
const normalizedQuery = query.toLowerCase()

const bridge = await api.load()
const items = Object.values(bridge.state.getLocalState()?.items || {})
.filter(item => item?.id?.includes(query) || (item?.data?.name || '').includes(query))
.filter(item =>
(item?.id || '').toLowerCase().includes(normalizedQuery) ||
(item?.data?.name || '').toLowerCase().includes(normalizedQuery)
)

return items.map(item => {
console.log('Rendering', item)
return <ItemRow key={item?.id} item={item} />
})
}
Expand Down
7 changes: 6 additions & 1 deletion app/components/Palette/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
background: var(--base-color--background);
border: 1px solid var(--base-color--shade1);

border-radius: 8px;
border-radius: 9px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);

transform: translate(-50%, 0);
Expand All @@ -34,6 +34,11 @@
width: 100%;
}

.Palette-result {
max-height: calc(100vh - 100px);
overflow-y: scroll;
}

.Palette .Palette-resultLabel {
display: block;
margin: 0.3em 0.5em;
Expand Down

0 comments on commit 39f6307

Please sign in to comment.