From 7c2d6e81a7f2ef714fef50d419a6ab1971837940 Mon Sep 17 00:00:00 2001 From: satnaing Date: Mon, 9 Jun 2025 12:44:56 +0700 Subject: [PATCH 1/2] fix: improve back-to-top button to adapt layout changes properly Update back-to-top button to accommodate properly even if the max-width of the blog post is updated. Use `fixed` position on mobile and `sticky` position on large screens. --- src/assets/icons/IconArrowNarrowUp.svg | 1 + src/components/BackToTopButton.astro | 34 ++++++++++---------------- src/components/ShareLinks.astro | 6 ++++- src/layouts/PostDetails.astro | 14 ++++------- 4 files changed, 24 insertions(+), 31 deletions(-) create mode 100644 src/assets/icons/IconArrowNarrowUp.svg diff --git a/src/assets/icons/IconArrowNarrowUp.svg b/src/assets/icons/IconArrowNarrowUp.svg new file mode 100644 index 0000000000..ac166a36c5 --- /dev/null +++ b/src/assets/icons/IconArrowNarrowUp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/components/BackToTopButton.astro b/src/components/BackToTopButton.astro index 98650959b4..c2f7617df8 100644 --- a/src/components/BackToTopButton.astro +++ b/src/components/BackToTopButton.astro @@ -1,41 +1,33 @@ --- import IconChevronLeft from "@/assets/icons/IconChevronLeft.svg"; - -/* -In #btt-btn-container, left position is `left-[calc((var(--container-3xl)/2)+50%+1rem)]`. -This is because we use `max-w-3xl` in `PostDetails.astro`. -If `max-width` in `PostDetails.astro` get updated, make sure to update the `var(--container-3xl)` as well. -max-w-3xl => var(--container-3xl) -max-w-4xl => var(--container-4xl) -max-w-5xl => var(--container-5xl) -etc... -*/ +import IconArrowNarrowUp from "@/assets/icons/IconArrowNarrowUp.svg"; ---
diff --git a/src/components/ShareLinks.astro b/src/components/ShareLinks.astro index 55a642ad01..6b95369dc9 100644 --- a/src/components/ShareLinks.astro +++ b/src/components/ShareLinks.astro @@ -7,7 +7,11 @@ const URL = Astro.url; { SHARE_LINKS.length > 0 && ( -
+
Share this post on:
{SHARE_LINKS.map(social => ( diff --git a/src/layouts/PostDetails.astro b/src/layouts/PostDetails.astro index 039322edf9..a846060583 100644 --- a/src/layouts/PostDetails.astro +++ b/src/layouts/PostDetails.astro @@ -110,17 +110,13 @@ const nextPost = - +
    + {tags.map(tag => )} +
-
-
    - {tags.map(tag => )} -
+ - -
+
From 93f504e75820eb72919b212e0a020c256d378322 Mon Sep 17 00:00:00 2001 From: satnaing Date: Tue, 10 Jun 2025 08:00:09 +0700 Subject: [PATCH 2/2] refactor: update className style in ShareLink --- src/components/ShareLinks.astro | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/components/ShareLinks.astro b/src/components/ShareLinks.astro index 6b95369dc9..d65a0de1ea 100644 --- a/src/components/ShareLinks.astro +++ b/src/components/ShareLinks.astro @@ -7,11 +7,7 @@ const URL = Astro.url; { SHARE_LINKS.length > 0 && ( -
+
Share this post on:
{SHARE_LINKS.map(social => (