Skip to content

Commit

Permalink
client: add margin below post for symmetry
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunternif committed Feb 16, 2025
1 parent ee14b77 commit faf5868
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions client/js/views/post_main_view.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"use strict";

const iosCorrectedInnerHeight = require("ios-inner-height");
const router = require("../router.js");
const views = require("../util/views.js");
const uri = require("../util/uri.js");
Expand All @@ -21,21 +20,24 @@ class PostMainView {

const sourceNode = template(ctx);
const postContainerNode = sourceNode.querySelector(".post-container");
const sidebarNode = sourceNode.querySelector(".sidebar");
views.replaceContent(this._hostNode, sourceNode);
views.syncScrollPosition();

const topNavigationNode =
document.body.querySelector("#top-navigation");

this._postContentControl = new PostContentControl(
postContainerNode,
ctx.post,
() => {
// Need add extra margin at the bottom for symmetry:
const postContainerRect =
postContainerNode.getBoundingClientRect();
const margin =
postContainerRect.top -
this._hostNode.getBoundingClientRect().top;
return [
postContainerNode.getBoundingClientRect().width,
iosCorrectedInnerHeight() -
postContainerNode.getBoundingClientRect().top,
postContainerRect.width,
window.visualViewport.height -
postContainerRect.top -
margin,
];
}
);
Expand Down Expand Up @@ -164,7 +166,7 @@ class PostMainView {
}
commentForm.hidden = true; // collapse by default
addCommentButton.addEventListener("click", () => {
commentForm.hidden = !commentForm.hidden
commentForm.hidden = !commentForm.hidden;
});
}

Expand Down

0 comments on commit faf5868

Please sign in to comment.