From 2b6da38c462fcfde3e3e50695d9836c22a5cef88 Mon Sep 17 00:00:00 2001 From: Nikhil Tanwar <2002nikhiltanwar@gmail.com> Date: Wed, 29 Jun 2022 15:02:24 +0530 Subject: [PATCH] Center tiles on welcome page This change centers tiles on welcome page to give a more consistent whitespace look on both sides. For this, the layout in Isotope JS is changed to masonry. --- static/skin/index.css | 22 ++++++++++++---------- static/skin/index.js | 7 +++---- static/templates/index.html | 5 +++-- test/server.cpp | 4 ++-- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/static/skin/index.css b/static/skin/index.css index 8443feacb..8e4bad729 100644 --- a/static/skin/index.css +++ b/static/skin/index.css @@ -31,7 +31,7 @@ body { font-size: 1.6rem; color: #333333; font-family: poppins; - margin: 10px 0 -5px; + margin: -10px 0 -5px; position: relative; top: -10px; left: 13px; @@ -129,9 +129,12 @@ body { } .kiwixHomeBody { - padding: 20px 15vw; + padding: 20px 0; min-height: calc(100vh - 170px); position: relative; + display: flex; + flex-direction: column; + align-items: center; } .tagFilterLabel { @@ -157,6 +160,8 @@ body { .book__list { position: relative; + margin: 0 auto; + padding-top: 20px; } .book { @@ -440,13 +445,16 @@ body { @media screen and (max-width: 1100px) { .kiwixHomeBody { - padding: 20px 10vw; min-height: calc(100vh - 170px); } .kiwixNav__filters { grid-template-columns: repeat(4, 1fr); } + + .book__wrapper { + margin: 10px; + } } @media screen and (max-width: 590px) { @@ -475,10 +483,4 @@ body { .kiwixNav__filters { grid-template-columns: 1fr; } -} - -@media screen and (max-width: 340px) { - .kiwixHomeBody { - padding: 20px 5vw; - } -} +} \ No newline at end of file diff --git a/static/skin/index.js b/static/skin/index.js index 83ad0e8c8..7d892e98a 100644 --- a/static/skin/index.js +++ b/static/skin/index.js @@ -449,10 +449,9 @@ } }, sortBy: 'weight', - layoutMode: 'cellsByRow', - cellsByRow: { - columnWidth: '.book', - rowHeight: '.book' + layoutMode: 'masonry', + masonry: { + fitWidth: true } }); footer = document.getElementById('kiwixfooter'); diff --git a/static/templates/index.html b/static/templates/index.html index 0dabc45b7..cd4c63d3b 100644 --- a/static/templates/index.html +++ b/static/templates/index.html @@ -63,8 +63,9 @@