summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHunternif <hunternif@gmail.com>2025-02-16 21:01:47 +0000
committerHunternif <hunternif@gmail.com>2025-02-16 21:01:47 +0000
commitfaf586899680d48be50af065b93933664ce9c61a (patch)
tree02c16e7c7d62b726efefeadcefd2920ee3d61e31
parentee14b77329a4ce312382dc4c5f63bed72ebb2695 (diff)
client: add margin below post for symmetry
-rw-r--r--client/js/views/post_main_view.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/client/js/views/post_main_view.js b/client/js/views/post_main_view.js
index c6b312b..3d35d19 100644
--- a/client/js/views/post_main_view.js
+++ b/client/js/views/post_main_view.js
@@ -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");
@@ -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,
];
}
);
@@ -164,7 +166,7 @@ class PostMainView {
}
commentForm.hidden = true; // collapse by default
addCommentButton.addEventListener("click", () => {
- commentForm.hidden = !commentForm.hidden
+ commentForm.hidden = !commentForm.hidden;
});
}