mirror of
https://github.com/neosubhamoy/neosubhamoy-portfolio.git
synced 2025-12-20 01:09:35 +05:30
(feat): implemented basic search window panel with animation
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
<div id="floatingwindowwrapper" class="floatingwindowwrapper fixed top-0 left-0 w-screen h-screen z-30 bg-[rgba(0,_0,_0,_0.4)] hidden"></div>
|
||||
<div id="searchwindow" class="searchwindow w-[44vw] mx-auto min-h-[60vh] fixed inset-x-0 top-[30vh] z-40 justify-center items-center bg-bg_secondary rounded-xl hidden">
|
||||
|
||||
</div>
|
||||
<div id="floating-bar" class="fixed inset-x-0 bottom-[7vh] z-[50] flex justify-center items-center">
|
||||
<div id="searchbar" class="searchbar bg-bg_secondary rounded-full p-[0.30rem] flex items-center cursor-pointer mx-2 hover:shadow-[0px_0px_30px] hover:shadow-accent_primary_extratransparent transition transform duration-300">
|
||||
<button class="bg-accent_primary px-3 py-2 rounded-full"><i class="fa-solid fa-magnifying-glass text-bg_primary"></i></button>
|
||||
|
||||
@@ -177,3 +177,21 @@ background: #38BDF8;
|
||||
backdrop-filter: blur(16px);
|
||||
}
|
||||
}
|
||||
|
||||
.floatingsearch-window-show {
|
||||
display: flex;
|
||||
animation: searchWindowShow 0.5s ease-in-out;
|
||||
}
|
||||
|
||||
@keyframes searchWindowShow {
|
||||
from {
|
||||
width: 25vw;
|
||||
min-height: 30vh;
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
width: 44vw;
|
||||
min-height: 60vh;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ const closeBtn = document.getElementById("closebutton");
|
||||
const searchTxt = document.getElementById("searchtext");
|
||||
const searchInput = document.getElementById("searchinput");
|
||||
const windowWrapper = document.getElementById("floatingwindowwrapper");
|
||||
const searchWin = document.getElementById("searchwindow");
|
||||
let lastScrollTop = 0;
|
||||
|
||||
window.addEventListener("scroll", function () {
|
||||
@@ -27,7 +28,7 @@ window.addEventListener("scroll", function () {
|
||||
});
|
||||
|
||||
// function to open floating search window
|
||||
function activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper) {
|
||||
function activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper, searchWin) {
|
||||
floatingBar.classList.remove("floatingbar-click-slide-down");
|
||||
floatingBar.classList.add("floatingbar-click-slide-up");
|
||||
searchBar.classList.remove("searchbar-click-decrease-width");
|
||||
@@ -40,10 +41,11 @@ function activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt,
|
||||
document.body.classList.add("overflow-hidden");
|
||||
windowWrapper.classList.remove("hidden");
|
||||
windowWrapper.classList.add("flotingbar-window-wrapper-show");
|
||||
searchWin.classList.add("floatingsearch-window-show");
|
||||
}
|
||||
|
||||
// function to close floating search window
|
||||
function close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper) {
|
||||
function close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper, searchWin) {
|
||||
floatingBar.classList.remove("floatingbar-click-slide-up");
|
||||
floatingBar.classList.add("floatingbar-click-slide-down");
|
||||
searchBar.classList.remove("searchbar-click-increase-width");
|
||||
@@ -55,29 +57,30 @@ function close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, sea
|
||||
document.body.classList.remove("overflow-hidden");
|
||||
windowWrapper.classList.remove("flotingbar-window-wrapper-show");
|
||||
windowWrapper.classList.add("hidden");
|
||||
searchWin.classList.remove("floatingsearch-window-show");
|
||||
}
|
||||
|
||||
// when the search icon is clicked
|
||||
searchBar.addEventListener("click", function () {
|
||||
activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper);
|
||||
activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper, searchWin);
|
||||
});
|
||||
|
||||
// when ALT + K shortcut key is pressed
|
||||
document.addEventListener("keydown", function(event) {
|
||||
if (event.altKey && event.key === "k") {
|
||||
activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper);
|
||||
activate_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper, searchWin);
|
||||
}
|
||||
});
|
||||
|
||||
// when close button is clicked
|
||||
closeBtn.addEventListener("click", function () {
|
||||
close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper);
|
||||
close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper, searchWin);
|
||||
});
|
||||
|
||||
// when ESC key is pressed
|
||||
document.addEventListener("keydown", function(event) {
|
||||
if (event.key === "Escape") {
|
||||
close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper);
|
||||
close_search(searchBar, floatingBar, closeBtn, shareBtn, searchTxt, searchInput, windowWrapper, searchWin);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -607,6 +607,14 @@ video {
|
||||
top: 4.7rem;
|
||||
}
|
||||
|
||||
.top-\[20vh\] {
|
||||
top: 20vh;
|
||||
}
|
||||
|
||||
.top-\[30vh\] {
|
||||
top: 30vh;
|
||||
}
|
||||
|
||||
.z-10 {
|
||||
z-index: 10;
|
||||
}
|
||||
@@ -631,6 +639,10 @@ video {
|
||||
z-index: 50;
|
||||
}
|
||||
|
||||
.z-40 {
|
||||
z-index: 40;
|
||||
}
|
||||
|
||||
.mx-2 {
|
||||
margin-left: 0.5rem;
|
||||
margin-right: 0.5rem;
|
||||
@@ -676,6 +688,11 @@ video {
|
||||
margin-bottom: 0.30rem;
|
||||
}
|
||||
|
||||
.mx-auto {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.mb-1 {
|
||||
margin-bottom: 0.25rem;
|
||||
}
|
||||
@@ -880,6 +897,22 @@ video {
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.min-h-\[40vh\] {
|
||||
min-height: 40vh;
|
||||
}
|
||||
|
||||
.min-h-\[60vh\] {
|
||||
min-height: 60vh;
|
||||
}
|
||||
|
||||
.min-h-\[50vh\] {
|
||||
min-height: 50vh;
|
||||
}
|
||||
|
||||
.min-h-\[30vh\] {
|
||||
min-height: 30vh;
|
||||
}
|
||||
|
||||
.w-0 {
|
||||
width: 0px;
|
||||
}
|
||||
@@ -945,6 +978,30 @@ video {
|
||||
width: 100vw;
|
||||
}
|
||||
|
||||
.w-\[50vw\] {
|
||||
width: 50vw;
|
||||
}
|
||||
|
||||
.w-\[40vw\] {
|
||||
width: 40vw;
|
||||
}
|
||||
|
||||
.w-\[45vw\] {
|
||||
width: 45vw;
|
||||
}
|
||||
|
||||
.w-\[43vw\] {
|
||||
width: 43vw;
|
||||
}
|
||||
|
||||
.w-\[44vw\] {
|
||||
width: 44vw;
|
||||
}
|
||||
|
||||
.w-\[20vw\] {
|
||||
width: 20vw;
|
||||
}
|
||||
|
||||
.rotate-\[15deg\] {
|
||||
--tw-rotate: 15deg;
|
||||
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
||||
@@ -1032,6 +1089,10 @@ video {
|
||||
border-radius: 0.5rem;
|
||||
}
|
||||
|
||||
.rounded-xl {
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
|
||||
.border-\[1px\] {
|
||||
border-width: 1px;
|
||||
}
|
||||
@@ -1113,6 +1174,11 @@ video {
|
||||
background-color: rgb(30 41 59 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.bg-bg_third {
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: rgb(38 51 74 / var(--tw-bg-opacity));
|
||||
}
|
||||
|
||||
.bg-gradient-to-r {
|
||||
background-image: linear-gradient(to right, var(--tw-gradient-stops));
|
||||
}
|
||||
@@ -1373,17 +1439,6 @@ video {
|
||||
filter: var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow);
|
||||
}
|
||||
|
||||
.backdrop-blur-lg {
|
||||
--tw-backdrop-blur: blur(16px);
|
||||
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
}
|
||||
|
||||
.backdrop-filter {
|
||||
-webkit-backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
backdrop-filter: var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);
|
||||
}
|
||||
|
||||
.transition {
|
||||
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, -webkit-backdrop-filter;
|
||||
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
|
||||
|
||||
Reference in New Issue
Block a user