Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions _includes/current-projects.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% include search-tip-modal.html %}
Comment thread
daras-cu marked this conversation as resolved.
<a class="anchor" id="projects"></a>
<section class="content-section projects filter-content-container">
<nav class="filter-toolbar" aria-label="Filter Navbar">
Expand Down Expand Up @@ -28,6 +29,10 @@ <h3 class="filters-title">
Apply
</button>
</div>
<!-- Add Search Tip Link for Desktop -->
<div class="search-tip-link">
<a href="#" id="search-tip-link">Search Tips</a>
</div>
</div>
</nav>

Expand Down
47 changes: 47 additions & 0 deletions _includes/search-tip-modal.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!-- Modal Structure -->
Comment thread
daras-cu marked this conversation as resolved.
<div class="search-tip-overlay" id="search-tip-modal">
<div class="search-tip-modal-container">
<div class="top-buffer"></div>
<div class="search-tip-modal-card">
<img class="overlay-close-icon" src="/assets/images/wins-page/x.svg" alt="Close">
<div class="search-tip-card center-screen">
<div class="search-tip-card-top">
<div class="search-card-title project-card-inner">
<span id="overlay-name" class="search-tip-card-name">Blank</span>
Comment thread
daras-cu marked this conversation as resolved.
</div>
</div>
<div class="search-tip-card-bottom">
<div class="project-inner overlay-card-text">
<table id="search-tip-table" class="search-tip-table">
<thead>
<tr>
<th>Boolean Operators</th>
<th>Meaning</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td id="table-operator-1">Blank</td>
<td id="table-meaning-1">Blank</td>
<td id="table-example-1">Blank</td>
</tr>
<tr>
<td id="table-operator-2">Blank</td>
<td id="table-meaning-2">Blank</td>
<td id="table-example-2">Blank</td>
</tr>
<tr>
<td id="table-operator-3">Blank</td>
<td id="table-meaning-3">Blank</td>
<td id="table-example-3">Blank</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="bottom-buffer"></div>
</div>
</div>
124 changes: 123 additions & 1 deletion _sass/components/_projects-page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,126 @@

.project-card-field-inline {
display: inline;
}
}

// Further instructions for search-bar functionality using a modal.
.search-tip-link {
text-decoration: underline;
cursor: pointer;
display: block;
margin: 10px 0;
padding: 10px 0;
border-top: solid 1px #cccccc;
}

// Modal Card
.search-tip-modal-card {
background: $color-white;
border: 0 solid rgba($color-black, 0.06);
border-radius: 16px;
box-shadow: 0 0 8px 0 rgba($color-black, 0.2);
margin-bottom: 24px;
overflow: hidden;

@media #{$bp-tablet-up} {
margin-bottom: 0;
}
}
.search-tip-card{
padding: 45px;
display: flex;
position: relative;
flex-direction: column;
overflow: visible;
}

.search-tip-card-top{
display: flex;
}

.search-tip-card-title{
display: flex;
justify-content: space-between;
}

.search-tip-card-name{
font-size: 19px;
line-height: 22px;
}

// Modal Overlay
.search-tip-overlay {
display: none;
z-index: 120;
position: fixed;
left: 0px;
top: 0px;
width: 100vw;
height: 100%;
background-color: rgba(70, 70, 70, 0.5);
padding: 10px;
overflow-y: auto;
overflow-x: hidden;
}

.top-buffer{
Comment thread
daras-cu marked this conversation as resolved.
height: 20vh;
}
.bottom-buffer {
height: 5vh;
}
.search-tip-modal-container{
position: absolute;
width: 60%;
left: 20%;
z-index: 121;
}

.overlay-close-icon {
float: right;
padding: 20px 20px 0 0;
cursor: pointer;
}
.center-screen {
opacity: 1;
}
.overlay-card-text{
padding-top: 40px;
}

@media screen and (max-width: 768px) {
.search-tip-modal-container {
width: 90%;
left: 5%;
}
}

// Search Tip Table Styling
.search-tip-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;

th, td {
padding: 12px;
text-align: left;
border-bottom: 1px solid #ddd;
}

th {
background-color: #f4f4f4;
font-weight: bold;
}

td {
vertical-align: top;
}

tr:last-child td {
border-bottom: none;
}

@media screen and (max-width: 768px) {
font-size: 14px;
}
}
45 changes: 45 additions & 0 deletions assets/js/current-projects.js
Comment thread
daras-cu marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ document.addEventListener("DOMContentLoaded",function(){
})
document.querySelector(".cancel-mobile-filters").addEventListener("click", cancelMobileFiltersEventHandler)
document.addEventListener('keydown', tabFocusedKeyDownHandler);

// Event listener for search tip modal
openSearchTipsModal();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please rename the function to "attachEventListenerTo...". We want the function names to be as close to a description of the functionality as possible!


// Close Search Tips Modal.
closeSearchTipsModal();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please rename the function to "attachEventListenerTo...". We want the function names to be as close to a description of the functionality as possible!


//events related to search bar
document.querySelector("#search").addEventListener("focus",searchOnFocusEventHandler);
Expand Down Expand Up @@ -859,4 +865,43 @@ function toggleNoResultMsgIfNoMatch(filtersParams,querySelector) {
} else {
document.querySelector(".no-results-message").innerHTML = ""
}
}

function openSearchTipsModal() {
document.getElementById('search-tip-link').addEventListener('click', function (event) {
event.preventDefault();
updateSearchTipsModal();
});
}

function updateSearchTipsModal() {
// Update the modal content with data
document.getElementById('overlay-name').innerHTML = "Search Tips";
Comment thread
daras-cu marked this conversation as resolved.
document.getElementById('table-operator-1').innerHTML = "<strong>AND</strong>";
document.getElementById('table-meaning-1').innerHTML = "Limit results";
document.getElementById('table-example-1').innerHTML = "<em>React and Node (Search for project cards that contain both React and Node.)</em>";
document.getElementById('table-operator-2').innerHTML = "<strong>OR</strong>";
document.getElementById('table-meaning-2').innerHTML = "One term OR another";
document.getElementById('table-example-2').innerHTML = "<em>Python or Javascript (Search for project cards that contains Python or JavaScript.)</em>";
document.getElementById('table-operator-3').innerHTML = "<strong>-</strong>";
document.getElementById('table-meaning-3').innerHTML = "Exclude a term from the search";
document.getElementById('table-example-3').innerHTML = "<em>React -Django (Limits project card results to only those with React and not the term Django.)</em>";

// Show the modal
document.getElementById('search-tip-modal').style.display = 'flex';
}

function closeSearchTipsModal() {
// Close the modal
document.querySelector('.overlay-close-icon').addEventListener('click', function() {
document.getElementById('search-tip-modal').style.display = 'none';
});

// Close modal when clicking outside of it
window.addEventListener('click', function(event) {
const modal = this.document.getElementById('search-tip-modal');
if (event.target === modal) {
modal.style.display = 'none';
}
});
}