Skip to content

Commit

Permalink
Clean up a little bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
ektrah committed Jul 1, 2024
1 parent a23ddc1 commit 78d762c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
15 changes: 2 additions & 13 deletions packages/explorer-site/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,22 @@ document.addEventListener("DOMContentLoaded", function () {
const resultsDiv = document.getElementById("results") as HTMLDivElement;

if (searchInput && resultsDiv) {
searchInput.addEventListener("input", (ev) => {
searchInput.addEventListener("input", function () {
const searchResults = fuse.search(searchInput.value);
if (searchResults.length) {
const ul = document.createElement("ul");
ul.className = "search-results";

ul.style.listStyleType = "none";
ul.style.padding = "0";
ul.style.margin = "0";

for (const result of searchResults) {
const li = document.createElement("li");
li.classList.add("result-item");

const a = document.createElement("a");
a.href = result.item.id;
a.dataset.href = "/" + result.item.name.replace(/:/g, "/");
a.textContent = result.item.name;

li.append(a);

ul.appendChild(li);
};

// Display the results dropdown
resultsDiv.style.display = "block";
resultsDiv.replaceChildren(ul);
resultsDiv.style.display = "block";
} else {
resultsDiv.textContent = "No results found";
resultsDiv.style.display = "none";
Expand Down
18 changes: 8 additions & 10 deletions packages/explorer-views/src/pages/navigation.css
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
nav {
cursor: default;
display: flex;
flex-direction: column;
gap: 1em;
display: grid;
grid-gap: 1em;
grid-template-rows: min-content minmax(0, 1fr);
height: 100vh;
left: 0;
padding: 1.5em 2px 1em 1em;
position: fixed;
top: 0;
width: 25vw;
box-sizing: border-box;
}

nav p {
Expand All @@ -18,18 +17,17 @@ nav {
}

nav .tabview {
display: flex;
flex-direction: column;
flex-grow: 1;
display: grid;
grid-template-rows: min-content minmax(0, 1fr);
margin: 0;
}

nav .tabview-pages {
background: var(--base01);
border: 1px solid var(--base02);
padding: 1.5rem 0.5rem 5rem;
overflow: auto;
flex-grow: 1;
padding: 1.5rem .5rem 5rem;
overflow: clip auto;
overscroll-behavior: none;
}

nav ul {
Expand Down

0 comments on commit 78d762c

Please sign in to comment.