Skip to content

Commit

Permalink
refactor: hide network searchbar when not required
Browse files Browse the repository at this point in the history
  • Loading branch information
fraxken committed Nov 30, 2024
1 parent 778a0e4 commit 6ba5b71
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions public/components/navigation/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ export class ViewNavigation {
selectedNav.classList.add("active");
this.setAnchor(menuName);

const searchbar = document.getElementById("searchbar");
if (searchbar) {
searchbar.style.display = menuName === "network--view" ? "flex" : "none";
}

this.activeMenu = selectedNav;
}

Expand Down
15 changes: 10 additions & 5 deletions public/components/searchbar/searchbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
display: flex;
height: inherit;
box-sizing: border-box;
border-left: 2px solid #0f041a;
}

#searchbar>* {
Expand Down Expand Up @@ -197,7 +198,7 @@ div.search-result-pannel .package+.package {
}

#search-nav {
z-index: 200;
z-index: 30;
display: flex;
justify-content: center;
align-items: center;
Expand All @@ -209,6 +210,7 @@ div.search-result-pannel .package+.package {
box-sizing: border-box;
background: var(--primary);
transform: skewX(-20deg);
box-shadow: 2px 1px 10px #26107f7a;
}

#search-nav .search-result-pannel .package {
Expand Down Expand Up @@ -259,6 +261,10 @@ div.search-result-pannel .package+.package {
background: linear-gradient(to right, rgba(55,34,175,1) 0%,rgba(87,74,173,1) 50%,rgb(59, 110, 205) 100%);
}

#search-nav .packages>.package.active>b {
background: var(--secondary);
}

#search-nav .packages>.package.active>.remove {
display: block;
}
Expand All @@ -282,17 +288,16 @@ div.search-result-pannel .package+.package {
background: var(--secondary-darker);
cursor: pointer;
padding: 0 7px;
border-right: 2px solid #0f041a;
transition: 0.5s all ease;
transition: 0.2s all ease;
color: #def7ff;
}

#search-nav .add:hover {
background: #1566b6;
background: var(--secondary);
cursor: pointer;
}

#search-nav .add>p {
#search-nav .add>i {
transform: skewX(20deg);
}

Expand Down
4 changes: 3 additions & 1 deletion public/core/search-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export function initSearchNav(data, nsn, secureDataSet) {

const plusButtonElement = document.createElement("button");
plusButtonElement.classList.add("add");
plusButtonElement.appendChild(createDOMElement("p", { text: "+" }));
plusButtonElement.appendChild(createDOMElement("p", {
text: "+"
}));
plusButtonElement.addEventListener("click", () => {
window.navigation.setNavByName("search--view");
});
Expand Down
2 changes: 1 addition & 1 deletion views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ <h2><i class="icon-keyboard"></i>[[=z.token('settings.shortcuts.title')]]</h2>

<template id="searchbar-tpl">
<div id="searchbar">
<i class="icon-search"></i>
<i class="icon-globe-alt-outline"></i>
<div class="search-items"></div>
<input type="text" placeholder="[[=z.token('searchbar_placeholder')]]" id="search-bar-input" autocomplete="off"
autocorrect="off" autocapitalize="off" spellcheck="false"></input>
Expand Down

0 comments on commit 6ba5b71

Please sign in to comment.