perf: improve the responsive design for ultrawide screens (#540)

Resolves #540
This commit is contained in:
Cotes Chung 2022-06-08 16:15:38 +08:00
parent 20caace68a
commit 5d6e8c5ef6
No known key found for this signature in database
GPG key ID: 0D9E54843167A808
7 changed files with 73 additions and 208 deletions

View file

@ -1,9 +1,7 @@
<!-- <!-- The Footer -->
The Footer
-->
<footer class="d-flex w-100 justify-content-center"> <footer class="row">
<div class="d-flex justify-content-between align-items-center text-muted"> <div class="col-12 d-flex justify-content-between align-items-center text-muted pl-0 pr-0">
<div class="footer-left"> <div class="footer-left">
<p class="mb-0"> <p class="mb-0">
© {{ 'now' | date: "%Y" }} © {{ 'now' | date: "%Y" }}
@ -33,5 +31,6 @@
</p> </p>
</div> </div>
</div> <!-- div.d-flex --> </div>
</footer> </footer>

View file

@ -2,7 +2,7 @@
The paginator for post list on HomgPage. The paginator for post list on HomgPage.
--> -->
<ul class="pagination align-items-center mt-4 mb-0 pl-lg-2"> <ul class="pagination align-items-center mt-4 mb-5 pl-lg-2">
<!-- left arrow --> <!-- left arrow -->
{% if paginator.previous_page %} {% if paginator.previous_page %}
{% assign prev_url = paginator.previous_page_path | relative_url %} {% assign prev_url = paginator.previous_page_path | relative_url %}

View file

@ -2,8 +2,8 @@
The Top Bar The Top Bar
--> -->
<div id="topbar-wrapper" class="row justify-content-center"> <div id="topbar-wrapper">
<div id="topbar" class="col-11 d-flex h-100 align-items-center justify-content-between"> <div id="topbar" class="container d-flex align-items-center justify-content-between h-100 pl-3 pr-3 pl-md-4 pr-md-4">
<span id="breadcrumb"> <span id="breadcrumb">
{% assign paths = page.url | split: '/' %} {% assign paths = page.url | split: '/' %}

View file

@ -25,8 +25,8 @@ layout: compress
{% include topbar.html %} {% include topbar.html %}
<div id="main-wrapper"> <div id="main-wrapper" class="d-flex justify-content-center">
<div id="main"> <div id="main" class="container">
{{ content }} {{ content }}

View file

@ -9,8 +9,8 @@ layout: default
<div class="row"> <div class="row">
<!-- core --> <!-- core -->
<div id="core-wrapper" class="col-12 col-lg-11 col-xl-8"> <div id="core-wrapper" class="col-12 col-lg-11 col-xl-9 pr-xl-5">
<div class="post pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4"> <div class="post pl-1 pr-1 pl-md-2 pr-md-2">
{% capture _content %} {% capture _content %}
{% if layout.refactor or page.layout == 'page' %} {% if layout.refactor or page.layout == 'page' %}
@ -54,13 +54,11 @@ layout: default
<!-- tail --> <!-- tail -->
{% if layout.tail_includes %} {% if layout.tail_includes %}
<div class="row"> <div class="row">
<div class="col-12 col-lg-11 col-xl-8"> <div id="tail-wrapper" class="col-12 col-lg-11 col-xl-9 pl-4 pr-4 pr-xl-5">
<div id="tail-wrapper" class="pl-1 pr-1 pl-sm-2 pr-sm-2 pl-md-4 pr-md-4">
{% for _include in layout.tail_includes %} {% for _include in layout.tail_includes %}
{% assign _include_path = _include | append: '.html' %} {% assign _include_path = _include | append: '.html' %}
{% include {{ _include_path }} %} {% include {{ _include_path }} %}
{% endfor %} {% endfor %}
</div> </div>
</div> </div>
</div> <!-- .row -->
{% endif %} {% endif %}

View file

@ -148,18 +148,15 @@ kbd {
} }
footer { footer {
position: absolute; @include pl-pr(1.5rem);
bottom: 0;
padding: 0 1rem;
height: $footer-height;
font-size: 0.8rem; font-size: 0.8rem;
> div.d-flex { > div.d-flex {
height: $footer-height;
line-height: 1.2rem; line-height: 1.2rem;
width: 95%; padding-bottom: 1rem;
max-width: 1045px;
border-top: 1px solid var(--main-border-color); border-top: 1px solid var(--main-border-color);
margin-bottom: 1rem;
> div { > div {
width: 350px; width: 350px;
@ -227,7 +224,6 @@ img[data-src] {
.access { .access {
top: 2rem; top: 2rem;
transition: top 0.2s ease-in-out; transition: top 0.2s ease-in-out;
margin-right: 1.5rem;
margin-top: 3rem; margin-top: 3rem;
margin-bottom: 4rem; margin-bottom: 4rem;
@ -876,6 +872,7 @@ $sidebar-display: "sidebar-display";
#search-result-wrapper { #search-result-wrapper {
display: none; display: none;
height: 100%; height: 100%;
width: 100%;
overflow: auto; overflow: auto;
.post-content { .post-content {
@ -933,7 +930,7 @@ $sidebar-display: "sidebar-display";
#search-wrapper { #search-wrapper {
display: flex; display: flex;
width: 85%; width: 100%;
border-radius: 1rem; border-radius: 1rem;
border: 1px solid var(--search-wrapper-border-color); border: 1px solid var(--search-wrapper-border-color);
background: var(--search-wrapper-bg); background: var(--search-wrapper-bg);
@ -1002,7 +999,7 @@ $sidebar-display: "sidebar-display";
} }
#search-results { #search-results {
padding-bottom: 6rem; padding-bottom: 3rem;
a { a {
&:hover { &:hover {
@ -1055,7 +1052,7 @@ $sidebar-display: "sidebar-display";
} }
#core-wrapper { #core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}) !important; min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
.categories, .categories,
#tags, #tags,
@ -1088,29 +1085,13 @@ $sidebar-display: "sidebar-display";
background-color: var(--main-wrapper-bg); background-color: var(--main-wrapper-bg);
position: relative; position: relative;
min-height: 100vh; min-height: 100vh;
padding-bottom: $footer-height;
@include pl-pr(0); @include pl-pr(0);
} }
#main { #core-wrapper,
.row:first-child { #panel-wrapper {
> div {
&:nth-child(1),
&:nth-child(2) {
margin-top: $topbar-height; /* same as the height of topbar */ margin-top: $topbar-height; /* same as the height of topbar */
}
&:first-child {
/* 3rem for topbar, 6rem for footer */
min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height});
}
}
}
div.row:first-of-type:last-of-type { /* alone */
margin-bottom: 4rem;
}
} }
#topbar-wrapper.row, #topbar-wrapper.row,
@ -1205,16 +1186,11 @@ $sidebar-display: "sidebar-display";
*/ */
@media all and (max-width: 576px) { @media all and (max-width: 576px) {
$footer-height: $footer-height-mobile; /* overwrite */
footer { footer {
height: $footer-height; height: $footer-height-mobile;
> div.d-flex { > div.d-flex {
width: 100%;
padding: 1.5rem 0; padding: 1.5rem 0;
margin-bottom: 0.3rem;
flex-wrap: wrap; flex-wrap: wrap;
-ms-flex-pack: distribute !important; -ms-flex-pack: distribute !important;
justify-content: space-around !important; justify-content: space-around !important;
@ -1226,12 +1202,8 @@ $sidebar-display: "sidebar-display";
} }
} }
#main > div.row:first-child > div:first-child {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height});
}
#core-wrapper { #core-wrapper {
min-height: calc(100vh - #{$topbar-height} - #{$footer-height} - #{$bottom-min-height}) !important; min-height: calc(100vh - #{$topbar-height} - #{$footer-height-mobile}) !important;
h1 { h1 {
margin-top: 2.2rem; margin-top: 2.2rem;
@ -1256,10 +1228,21 @@ $sidebar-display: "sidebar-display";
@include ml-mr(1.8rem); @include ml-mr(1.8rem);
} }
#main-wrapper { }
padding-bottom: $footer-height;
@media all and (max-width: 768px) {
%full-width {
max-width: 100%;
} }
#topbar {
@extend %full-width;
}
#main {
@extend %full-width;
@include pl-pr(0);
}
} }
/* hide sidebar and panel */ /* hide sidebar and panel */
@ -1310,6 +1293,11 @@ $sidebar-display: "sidebar-display";
padding-top: $topbar-height; padding-top: $topbar-height;
} }
#topbar,
#main {
max-width: 100%;
}
#search-result-wrapper { #search-result-wrapper {
width: 100%; width: 100%;
} }
@ -1325,8 +1313,8 @@ $sidebar-display: "sidebar-display";
left: 0; left: 0;
} }
#main > div.row:first-child > div:nth-child(1), #core-wrapper,
#main > div.row:first-child > div:nth-child(2) { #panel-wrapper {
margin-top: 0; margin-top: 0;
} }
@ -1336,17 +1324,6 @@ $sidebar-display: "sidebar-display";
display: block; display: block;
} }
#search-wrapper {
&.loaded ~ a {
margin-right: 1rem;
}
}
#search-input {
margin-left: 0;
width: 95%;
}
#search-result-wrapper .post-content { #search-result-wrapper .post-content {
letter-spacing: 0; letter-spacing: 0;
} }
@ -1395,17 +1372,17 @@ $sidebar-display: "sidebar-display";
margin-top: 3rem; margin-top: 3rem;
} }
#search-wrapper {
width: 22%;
min-width: 150px;
}
#search-hints { #search-hints {
display: none; display: none;
} }
#search-wrapper {
max-width: 210px;
}
#search-result-wrapper { #search-result-wrapper {
margin-top: 3rem; margin-top: 3rem;
max-width: $main-content-max-width;
} }
div.post-content .table-wrapper > table { div.post-content .table-wrapper > table {
@ -1415,17 +1392,17 @@ $sidebar-display: "sidebar-display";
/* button 'back-to-Top' position */ /* button 'back-to-Top' position */
#back-to-top { #back-to-top {
bottom: 5.5rem; bottom: 5.5rem;
right: 1.2rem; right: 5%;
}
#topbar {
@include pl-pr(2rem);
} }
#topbar-title { #topbar-title {
text-align: left; text-align: left;
} }
footer > div.d-flex {
width: 92%;
}
} }
/* Pad horizontal */ /* Pad horizontal */
@ -1499,10 +1476,6 @@ $sidebar-display: "sidebar-display";
display: none; display: none;
} }
#topbar {
padding: 0;
}
#main > div.row { #main > div.row {
-webkit-box-pack: center !important; -webkit-box-pack: center !important;
-ms-flex-pack: center !important; -ms-flex-pack: center !important;
@ -1513,26 +1486,12 @@ $sidebar-display: "sidebar-display";
/* --- desktop mode, both sidebar and panel are visible --- */ /* --- desktop mode, both sidebar and panel are visible --- */
@media all and (min-width: 1200px) { @media all and (min-width: 1200px) {
#main > div.row > div.col-xl-8 {
-webkit-box-flex: 0;
-ms-flex: 0 0 75%;
flex: 0 0 75%;
max-width: 75%;
padding-left: 3%;
}
#topbar {
padding: 0;
max-width: 1070px;
}
#panel-wrapper {
max-width: $panel-max-width;
}
#back-to-top { #back-to-top {
bottom: 6.5rem; bottom: 6.5rem;
right: 4.3rem; }
#search-wrapper {
margin-right: 4rem;
} }
#search-input { #search-input {
@ -1568,62 +1527,27 @@ $sidebar-display: "sidebar-display";
} }
@media all and (min-width: 1400px) { @media all and (min-width: 1400px) {
#main > div.row { #back-to-top {
padding-left: calc((100% - #{$main-content-max-width}) / 2); right: calc((100vw - #{$sidebar-width} - 1140px) / 2 + 3rem);
> div.col-xl-8 {
max-width: 850px;
}
}
#search-result-wrapper {
padding-right: 2rem;
> div {
max-width: 1110px;
}
}
}
@media all and (min-width: 1400px) and (max-width: 1650px) {
#topbar {
padding-right: 2rem;
} }
} }
@media all and (min-width: 1650px) { @media all and (min-width: 1650px) {
#breadcrumb {
padding-left: 0;
}
#main > div.row > div.col-xl-8 {
padding-left: 0;
> div:first-child {
padding-left: 0.55rem !important;
padding-right: 1.9rem !important;
}
}
#main-wrapper { #main-wrapper {
margin-left: $sidebar-width-large; margin-left: $sidebar-width-large;
} }
#panel-wrapper {
margin-left: calc((100% - #{$main-content-max-width}) / 10);
}
#topbar-wrapper { #topbar-wrapper {
left: $sidebar-width-large; left: $sidebar-width-large;
} }
#topbar { #topbar,
max-width: #{$main-content-max-width}; #main {
max-width: $main-content-max-width;
} }
#search-wrapper { #back-to-top {
margin-right: 3%; right: calc((100vw - #{$sidebar-width-large} - #{$main-content-max-width}) / 2 + 2rem);
} }
#sidebar { #sidebar {
@ -1744,58 +1668,4 @@ $sidebar-display: "sidebar-display";
} /* #sidebar */ } /* #sidebar */
footer > div.d-flex {
width: 92%;
max-width: 1140px;
}
#search-result-wrapper {
> div {
max-width: #{$main-content-max-width};
}
}
} /* min-width: 1650px */ } /* min-width: 1650px */
@media all and (min-width: 1700px) {
#topbar-wrapper {
/* 100% - 350px - (1920px - 350px); */
padding-right: calc(100% - #{$sidebar-width-large} - (1920px - #{$sidebar-width-large}));
}
#topbar {
max-width: calc(#{$main-content-max-width} + 20px);
}
#main > div.row {
padding-left: calc((100% - #{$main-content-max-width} - 2%) / 2);
}
#panel-wrapper {
margin-left: 3%;
}
footer {
padding-left: 0;
padding-right: calc(100% - #{$sidebar-width-large} - 1180px);
}
#back-to-top {
right: calc(100% - 1920px + 15rem);
}
}
@media (min-width: 1920px) {
#main > div.row {
padding-left: 190px;
}
#search-result-wrapper {
padding-right: calc(100% - #{$sidebar-width-large} - 1180px);
}
#panel-wrapper {
margin-left: 41px;
}
}

View file

@ -23,9 +23,7 @@ $topbar-height: 3rem !default;
$footer-height: 5rem !default; $footer-height: 5rem !default;
$footer-height-mobile: 6rem !default; /* screen width: <= 576px */ $footer-height-mobile: 6rem !default; /* screen width: <= 576px */
$main-content-max-width: 1150px !default; $main-content-max-width: 1200px !default;
$panel-max-width: 300px !default;
$bottom-min-height: 35rem !default; $bottom-min-height: 35rem !default;