Skip to content

Commit 158e3e8

Browse files
MananJethwanikelson42
authored andcommitted
minoor changes in responsive behaviour
1 parent 473b160 commit 158e3e8

File tree

3 files changed

+50
-59
lines changed

3 files changed

+50
-59
lines changed

static/skin/home.css

+28-52
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
@font-face {
2-
font-family: "poppins";
3-
src: url("{{root}}/skin/fonts/Poppins.ttf") format("truetype");
4-
}
5-
6-
@font-face {
7-
font-family: "roboto";
8-
src: url("{{root}}/skin/fonts/Roboto.ttf") format("truetype");
9-
}
10-
111
*,
122
*::after,
133
*::before {
@@ -34,7 +24,7 @@ body {
3424
background-color: #f4f6f8;
3525
width: 100%;
3626
padding: 20px 11vw;
37-
height: 17vh;
27+
height: 200px;
3828
}
3929

4030
.kiwixNav__results {
@@ -67,7 +57,8 @@ body {
6757

6858
.kiwixHomeBody {
6959
padding: 20px 15vw;
70-
min-height: 79vh;
60+
min-height: calc(100vh - 230px);
61+
position: relative;
7162
}
7263

7364
.book__list {
@@ -115,13 +106,14 @@ body {
115106

116107
.book__description {
117108
grid-column: 1 / 3;
118-
margin: 1px 10px;
109+
margin: 0.5px 10px;
119110
overflow: hidden;
120111
display: -webkit-box;
121-
-webkit-line-clamp: 9;
112+
-webkit-line-clamp: 8;
122113
-webkit-box-orient: vertical;
123114
font-family: roboto;
124115
font-weight: 300;
116+
font-size: 1.2rem;
125117
color: #4d4d4d;
126118
}
127119

@@ -142,10 +134,10 @@ body {
142134

143135
.book__tags {
144136
display: flex;
145-
text-align: right;
137+
text-align: end;
146138
margin-right: 10px;
147139
margin-top: 10px;
148-
justify-content: end;
140+
justify-content: flex-end;
149141
font-family: roboto;
150142
color: #909090;
151143
}
@@ -159,9 +151,8 @@ body {
159151
.book__links > a, .book__links > span {
160152
text-decoration: none;
161153
display: flex;
162-
text-align: right;
163-
justify-content: end;
164-
align-items: flex-end;
154+
text-align: -webkit-right;
155+
justify-content: flex-end;
165156
}
166157

167158
.book__links > a {
@@ -184,11 +175,12 @@ body {
184175
}
185176

186177
.noResults {
187-
position: absolute;
188-
top: 48%;
189-
width: 100%;
190-
text-align: center;
191178
font-size: 1.6rem;
179+
text-align: center;
180+
}
181+
182+
.noResults > a {
183+
color: #3498db;
192184
}
193185

194186
.loader-spinner {
@@ -231,7 +223,7 @@ body {
231223
justify-content: center;
232224
text-align: center;
233225
font-size: 1.6rem;
234-
height: 3vh;
226+
height: 30px;
235227
}
236228

237229
.kiwixfooter > a {
@@ -240,8 +232,13 @@ body {
240232

241233
@media screen and (max-width: 1100px) {
242234

235+
.kiwixNav {
236+
height: 250px;
237+
}
238+
243239
.kiwixHomeBody {
244-
padding: 20px 11vw;
240+
padding: 20px 10vw;
241+
min-height: calc(100vh - 280px);
245242
}
246243

247244
.kiwixNav__filters {
@@ -250,43 +247,22 @@ body {
250247
}
251248

252249
@media screen and (max-width: 650px) {
253-
.kiwixNav__filters {
254-
grid-template-columns: 1fr;
255-
}
256-
}
257-
258-
@media screen and (max-height: 900px) {
259250

260251
.kiwixNav {
261-
height: 31vh;
252+
height: 350px;
262253
}
263254

264255
.kiwixHomeBody {
265-
min-height: 64vh;
256+
min-height: calc(100vh - 380px);
266257
}
267258

268-
.kiwixfooter {
269-
height: 5vh;
259+
.kiwixNav__filters {
260+
grid-template-columns: 1fr;
270261
}
271-
272262
}
273263

274-
@media screen and (max-height: 450px) {
275-
276-
.kiwixNav {
277-
height: 55vh;
278-
}
279-
264+
@media screen and (max-width: 340px) {
280265
.kiwixHomeBody {
281-
min-height: 39vh;
282-
}
283-
284-
.kiwixfooter {
285-
height: 5vh;
266+
padding: 20px 5vw;
286267
}
287-
288-
.noResults {
289-
top: 65%;
290-
}
291-
292268
}

static/skin/index.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
};
77
const filterTypes = ['lang', 'category', 'q'];
88
const bookOrderMap = new Map();
9-
const loader = document.querySelector('.loader');
9+
let loader;
1010
let footer;
1111
let fadeOutDiv;
1212
let iso;
@@ -56,7 +56,7 @@
5656
.filter((tag, index, tags) => tags.indexOf(tag) === index).join(' | ');
5757
let downloadLink;
5858
try {
59-
downloadLink = book.querySelector('link[type="application/x-zim"]').getAttribute('href');
59+
downloadLink = book.querySelector('link[type="application/x-zim"]').getAttribute('href').split('.meta4')[0];
6060
} catch {
6161
downloadLink = '';
6262
}
@@ -116,16 +116,18 @@
116116
}
117117

118118
function checkAndInjectEmptyMessage() {
119+
const kiwixHomeBody = document.querySelector('.kiwixHomeBody');
119120
if (!bookOrderMap.size) {
120121
if (!noResultInjected) {
121122
noResultInjected = true;
122123
iso.remove(document.getElementsByClassName('book__list')[0].getElementsByTagName('a'));
123124
iso.layout();
124-
const spanTag = document.createElement('span');
125-
spanTag.setAttribute('class', 'noResults');
126-
spanTag.innerHTML = `No result. Would you like to <a href="/?lang=">reset filter?</a>`;
127-
document.querySelector('body').append(spanTag);
128-
spanTag.getElementsByTagName('a')[0].onclick = (event) => {
125+
const divTag = document.createElement('div');
126+
divTag.setAttribute('class', 'noResults');
127+
divTag.innerHTML = `No result. Would you like to<a href="/?lang="> reset filter?</a>`;
128+
kiwixHomeBody.append(divTag);
129+
kiwixHomeBody.setAttribute('style', 'display: flex; justify-content: center; align-items: center');
130+
divTag.getElementsByTagName('a')[0].onclick = (event) => {
129131
event.preventDefault();
130132
window.history.pushState({}, null, `${window.location.href.split('?')[0]}?lang=`);
131133
resetAndFilter();
@@ -137,6 +139,7 @@
137139
} else if (noResultInjected) {
138140
noResultInjected = false;
139141
document.getElementsByClassName('noResults')[0].remove();
142+
kiwixHomeBody.removeAttribute('style');
140143
}
141144
loader.removeAttribute('style');
142145
return false;
@@ -233,6 +236,7 @@
233236
});
234237
footer = document.getElementById('kiwixfooter');
235238
fadeOutDiv = document.getElementById('fadeOut');
239+
loader = document.querySelector('.loader');
236240
await loadAndDisplayBooks();
237241
await loadAndDisplayOptions('#languageFilter', langList);
238242
await loadAndDisplayOptions('#categoryFilter', categoryList);

static/templates/index.html

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@
2727
href="{{root}}/skin/home.css"
2828
rel="Stylesheet"
2929
/>
30+
<style>
31+
@font-face {
32+
font-family: "poppins";
33+
src: url("{{root}}/skin/fonts/Poppins.ttf") format("truetype");
34+
}
35+
36+
@font-face {
37+
font-family: "roboto";
38+
src: url("{{root}}/skin/fonts/Roboto.ttf") format("truetype");
39+
}
40+
</style>
3041
<script src="{{root}}/skin/isotope.pkgd.min.js" defer></script>
3142
<script src="{{root}}/skin/categoryList.js"></script>
3243
<script src="{{root}}/skin/langList.js"></script>

0 commit comments

Comments
 (0)