corrected select box and search bar design

This commit is contained in:
Manan Jethwani 2021-06-30 16:31:13 +05:30 committed by Emmanuel Engelhart
parent dd27c3a873
commit 0590f27fa1
5 changed files with 111 additions and 29 deletions

View File

@ -18,6 +18,7 @@ skin/jquery-ui/images/ui-bg_glass_95_fef1ec_1x400.png
skin/jquery-ui/jquery-ui.theme.min.css
skin/jquery-ui/jquery-ui.min.css
skin/caret.png
skin/search-icon.svg
skin/taskbar.js
skin/langList.js
skin/categoryList.js

View File

@ -27,11 +27,14 @@ body {
height: 200px;
}
.kiwixNav__results {
font-size: 1.3rem;
.kiwixHomeBody__results {
font-size: 1.6rem;
color: #333333;
font-family: poppins;
margin: 10px 0;
position: relative;
top: -10px;
left: 13px;
}
.kiwixNav__filters {
@ -42,17 +45,84 @@ body {
}
.kiwixNav__kiwixFilter {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
appearance: none;
outline: 0;
box-shadow: none;
border: 0 !important;
background: white;
background-image: none;
border-radius: 1px;
width: 195px;
height: 35px;
width: 231px;
border-radius: 100px;
border: solid 1px #b5b2b2;
}
.kiwixNav__kiwixFilter:-ms-expand {
display: none;
}
.kiwixNav__select {
position: relative;
display: flex;
width: 231px;
height: 35px;
line-height: 3;
background: #627B93;
overflow: hidden;
border-radius: 10px;
border: 1px solid #394856;
}
.kiwixNav__kiwixFilter {
flex: 1;
color: black;
padding: 7px 10px 10px;
cursor: pointer;
}
.kiwixNav__select::after {
content: '\25BC';
color: #fff;
background-color: #627B93;
height: 100%;
position: absolute;
top: 0;
right: 0;
padding: 0 1em;
cursor: pointer;
pointer-events: none;
-webkit-transition: .25s all ease;
-o-transition: .25s all ease;
transition: .25s all ease;
}
.kiwixSearch {
height: 35px;
width: 231px;
border-radius: 100px;
width: 229px;
border-radius: 10px;
border: solid 1px #b5b2b2;
padding: 10px;
background-image: url('./search-icon.svg');
background-repeat: no-repeat;
background-position: right center;
background-origin: content-box;
background-size: 15px;
}
.searchButton {
margin: 0 17px;
height: 35px;
width: 100px;
border-radius: 10px;
color: white;
background-color: #627B93;
border: solid 1px #b5b2b2;
}
.searchButton:hover {
background-color: #4f6478;
}
.kiwixHomeBody {
@ -96,6 +166,11 @@ body {
margin: 10px 0 0 10px;
}
.book__icon--image {
max-width: 100%;
max-height: 100%;
}
.book__title {
display: grid;
font-family: poppins;

View File

@ -73,18 +73,8 @@
const iconUrl = getInnerHtml(book, 'icon');
const language = getInnerHtml(book, 'language');
const tags = getInnerHtml(book, 'tags');
let tagHtml = tags.split(';').filter(tag => { return !(tag.split(':')[1] && tag.split(':')[1] == 'no')})
.map((tag) => {
tag = tag.split(':');
if (tag.length === 1) {
return tag[0].replace(/_/, ' ');
} else if (tag[1] !== 'yes') {
return tag[1].replace(/_/, ' ');
} else {
return (tag[0].indexOf('_') === 0 ? tag[0].replace('_', '') : tag[0]).replace(/_/, ' ');
}
})
.filter((tag, index, tags) => tags.indexOf(tag) === index).join(' | ');
let tagHtml = tags.split(';').filter(tag => {return !(tag.split(':')[0].startsWith('_'))})
.join(' | ').replace(/_/g, ' ');
let downloadLink;
let zimSize = 0;
try {
@ -102,7 +92,7 @@
if (sort) {
divTag.setAttribute('data-idx', bookOrderMap.get(id));
}
divTag.innerHTML = `<div class="book__wrapper"><div class='book__icon' ><img src='${iconUrl}'></div>
divTag.innerHTML = `<div class="book__wrapper"><div class='book__icon' ><img class="book__icon--image" src='${iconUrl}'></div>
<div class='book__title' title='${title}'>
<div id="bookTitle">${title}</div>
${humanFriendlyZimSize ? `<div id='bookSize'>${humanFriendlyZimSize}</div>`: ''}
@ -139,7 +129,7 @@
} else {
toggleFooter();
}
document.querySelector('.kiwixNav__results').innerHTML = `Results: ${results} items`
document.querySelector('.kiwixHomeBody__results').innerHTML = `${results} books`
loader.style.display = 'none';
return books;
});
@ -162,7 +152,7 @@
setTimeout(() => {
const divTag = document.createElement('div');
divTag.setAttribute('class', 'noResults');
divTag.innerHTML = `No result. Would you like to<a href="/?lang="> reset filter?</a>`;
divTag.innerHTML = `No result. Would you like to <a href="/?lang=">reset filter</a>?`;
kiwixHomeBody.append(divTag);
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
divTag.getElementsByTagName('a')[0].onclick = (event) => {
@ -226,6 +216,12 @@
bookOrderMap.clear();
params = new URLSearchParams(window.location.search);
if (filterType) {
const filter = document.getElementsByName(filterType)[0];
if (filterValue) {
filter.style = 'background-color: #4f6478; color: #fff';
} else {
filter.style = 'background-color: #ffffff; color: black';
}
params.set(filterType, filterValue);
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?${params.toString()}`);
setCookie(filterCookieName, params.toString());

View File

@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" version="1.0" width="512.000000" height="512.000000" preserveAspectRatio="xMidYMid meet" style=""><rect id="backgroundrect" width="100%" height="100%" x="0" y="0" fill="none" stroke="none"/>
<g class="currentLayer" style=""><title>Layer 1</title><g transform="translate(0,512) scale(0.10000000149011612,-0.10000000149011612) " fill="#484848" stroke="none" id="svg_1" class="selected" fill-opacity="1">
<path d="M1858 5104 c-341 -50 -678 -192 -963 -408 -104 -78 -304 -278 -384 -384 -124 -164 -256 -409 -315 -583 -311 -929 47 -1926 877 -2442 662 -410 1535 -405 2188 14 l76 49 125 -128 c69 -70 352 -364 630 -653 574 -597 548 -575 688 -567 85 5 123 21 176 75 52 52 77 114 77 193 0 98 -24 142 -151 273 -420 434 -1132 1177 -1132 1182 0 3 22 33 49 68 164 209 291 471 362 746 159 614 28 1255 -363 1774 -78 104 -279 305 -386 386 -288 218 -618 355 -974 406 -130 19 -448 18 -580 -1z m502 -545 c308 -38 607 -184 844 -409 476 -455 606 -1146 327 -1745 -128 -273 -356 -519 -626 -674 -387 -222 -857 -259 -1282 -102 -626 231 -1040 879 -983 1540 13 146 33 241 77 371 214 634 830 1060 1493 1032 36 -1 103 -7 150 -13z" id="svg_2" fill="#484848" fill-opacity="1"/>
</g></g></svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -46,14 +46,17 @@
</head>
<body>
<div class='kiwixNav'>
<h3 class="kiwixNav__results"></h3>
<div class="kiwixNav__filters">
<select name="lang" id="languageFilter" class='kiwixNav__kiwixFilter'>
<option value="" selected>All languages</option>
</select>
<select name="category" id="categoryFilter" class='kiwixNav__kiwixFilter'>
<option value="" selected>All categories</option>
</select>
<div class="kiwixNav__select">
<select name="lang" id="languageFilter" class='kiwixNav__kiwixFilter'>
<option value="" selected>All languages</option>
</select>
</div>
<div class="kiwixNav__select">
<select name="category" id="categoryFilter" class='kiwixNav__kiwixFilter'>
<option value="" selected>All categories</option>
</select>
</div>
</div>
<form id='kiwixSearchForm' class='kiwixNav__SearchForm'>
<input type="text" name="q" placeholder="Search" id="searchFilter" class='kiwixSearch'>
@ -61,6 +64,7 @@
</form>
</div>
<div class="kiwixHomeBody">
<h3 class="kiwixHomeBody__results"></h3>
<div class="book__list"></div>
<div id="fadeOut" class="fadeOut"></div>
</div>