Skip to content

Commit d81f836

Browse files
authored
refactor: simplify basic layout (#1039)
A dynamically expanding/collapsing topbar is difficult to maintain and not very useful.
1 parent 52f5ee9 commit d81f836

File tree

11 files changed

+26
-294
lines changed

11 files changed

+26
-294
lines changed

_includes/post-paginator.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- The paginator for post list on HomgPage. -->
22

3-
<ul class="pagination align-items-center mt-4 ps-lg-2">
3+
<ul class="pagination align-items-center my-4 ps-lg-2">
44
<!-- left arrow -->
55
{% if paginator.previous_page %}
66
{% assign prev_url = paginator.previous_page_path | relative_url %}

_includes/topbar.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div id="topbar-wrapper">
44
<div
55
id="topbar"
6-
class="container d-flex align-items-center justify-content-between h-100 px-3 px-md-4 px-xxl-5"
6+
class="container d-flex align-items-center justify-content-between h-100"
77
>
88
<span id="breadcrumb">
99
{% assign paths = page.url | split: '/' %}

_javascript/modules/components/back-to-top.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44

55
export function back2top() {
66
$(window).on('scroll', () => {
7-
if (
8-
$(window).scrollTop() > 50 &&
9-
$('#sidebar-trigger').css('display') === 'none'
10-
) {
7+
if ($(window).scrollTop() > 50) {
118
$('#back-to-top').fadeIn();
129
} else {
1310
$('#back-to-top').fadeOut();

_javascript/modules/components/convert-title.js

Lines changed: 0 additions & 66 deletions
This file was deleted.

_javascript/modules/components/search-display.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
const $btnSbTrigger = $('#sidebar-trigger');
55
const $btnSearchTrigger = $('#search-trigger');
66
const $btnCancel = $('#search-cancel');
7-
const $main = $('#main');
7+
const $content = $('#main>.row');
88
const $topbarTitle = $('#topbar-title');
99
const $searchWrapper = $('#search-wrapper');
1010
const $resultWrapper = $('#search-result-wrapper');
@@ -58,7 +58,7 @@ class ResultSwitch {
5858
// the block method must be called before $(#main) unloaded.
5959
ScrollBlocker.on();
6060
$resultWrapper.removeClass(C_UNLOADED);
61-
$main.addClass(C_UNLOADED);
61+
$content.addClass(C_UNLOADED);
6262
ScrollBlocker.resultVisible = true;
6363
}
6464
}
@@ -70,7 +70,7 @@ class ResultSwitch {
7070
$hints.removeClass(C_UNLOADED);
7171
}
7272
$resultWrapper.addClass(C_UNLOADED);
73-
$main.removeClass(C_UNLOADED);
73+
$content.removeClass(C_UNLOADED);
7474

7575
// now the release method must be called after $(#main) display
7676
ScrollBlocker.off();

_javascript/modules/components/topbar-switcher.js

Lines changed: 0 additions & 99 deletions
This file was deleted.

_javascript/modules/components/utils/scroll-helper.js

Lines changed: 0 additions & 64 deletions
This file was deleted.
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
import { convertTitle } from '../components/convert-title';
21
import { displaySearch } from '../components/search-display';
3-
import { switchTopbar } from '../components/topbar-switcher';
42

53
export function initTopbar() {
6-
convertTitle();
74
displaySearch();
8-
switchTopbar();
95
}

_layouts/default.html

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@
1919
<html lang="{{ site.alt_lang | default: site.lang }}" {{ prefer_mode }}>
2020
{% include head.html %}
2121

22-
<body data-topbar-visible="true">
22+
<body>
2323
{% include sidebar.html lang=lang %}
24-
{% include topbar.html lang=lang %}
2524

2625
<div id="main-wrapper" class="d-flex justify-content-center">
2726
<div id="main" class="container px-xxl-5">
27+
{% include topbar.html lang=lang %}
2828
{{ content }}
29+
{% include search-results.html lang=lang %}
2930
</div>
30-
31-
{% include search-results.html lang=lang %}
3231
</div>
3332

3433
{% include footer.html lang=lang %}

0 commit comments

Comments
 (0)