Skip to content
This repository has been archived by the owner on Apr 10, 2024. It is now read-only.

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
PrestonT500 authored Oct 27, 2023
1 parent ac56c45 commit 1f59d88
Showing 1 changed file with 9 additions and 22 deletions.
31 changes: 9 additions & 22 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,6 @@ const searchInput = document.getElementById("search-input");
const searchForm = document.getElementById("search-form");
const searchResults = document.getElementById("search-results");

function animateToTopCenter() {
container.style.justifyContent = "flex-start";
title.style.fontSize = "30px";
subtitle.style.fontSize = "14px";
searchInput.style.fontSize = "14px";
}

function animateToMiddleCenter() {
container.style.justifyContent = "center";
title.style.fontSize = "40px";
subtitle.style.fontSize = "18px";
searchInput.style.fontSize = "16px";
}

searchInput.addEventListener("input", function() {
if (searchInput.value.trim() !== "") {
animateToTopCenter();
} else {
animateToMiddleCenter();
}
});

async function performSearch(query) {
searchResults.textContent = "Searching...";

Expand All @@ -45,6 +23,7 @@ async function performSearch(query) {
return `
<div class="result-item">
<div class="result-details">
<img src="${result.Icon?.URL}" alt="Result Icon" class="result-icon">
<a href="${result.FirstURL}" target="_blank" class="result-title">${result.Text}</a>
<p class="result-url">${result.FirstURL}</p>
</div>
Expand All @@ -60,6 +39,14 @@ async function performSearch(query) {
}
}

searchInput.addEventListener("input", function() {
if (searchInput.value.trim() !== "") {
animateToTopCenter();
} else {
animateToMiddleCenter();
}
});

searchForm.addEventListener("submit", async function(event) {
event.preventDefault();
const query = searchInput.value;
Expand Down

0 comments on commit 1f59d88

Please sign in to comment.