mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 07:33:07 +08:00
5f72b93d92
* refactor: extract redundant max-width into utility Extract redundant max-width into a universal tailwind utility class. By doing so, the width of the layout in different pages can be customized easily. * docs: update docs for modifying `max-w-app` utility
38 lines
916 B
Plaintext
38 lines
916 B
Plaintext
---
|
|
import IconChevronLeft from "@/assets/icons/IconChevronLeft.svg";
|
|
import LinkButton from "./LinkButton.astro";
|
|
import { SITE } from "@/config";
|
|
---
|
|
|
|
{
|
|
SITE.showBackButton && (
|
|
<div class="mx-auto flex w-full max-w-app items-center justify-start px-2">
|
|
<LinkButton
|
|
id="back-button"
|
|
href="/"
|
|
class="focus-outline mt-8 mb-2 flex hover:text-foreground/75"
|
|
>
|
|
<IconChevronLeft class="inline-block size-6" />
|
|
<span>Go back</span>
|
|
</LinkButton>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
<script>
|
|
/* Update Search Praam */
|
|
function updateGoBackUrl() {
|
|
const backButton: HTMLAnchorElement | null =
|
|
document.querySelector("#back-button");
|
|
|
|
const backUrl = sessionStorage.getItem("backUrl");
|
|
|
|
if (backUrl && backButton) {
|
|
backButton.href = backUrl;
|
|
}
|
|
}
|
|
|
|
document.addEventListener("astro:page-load", updateGoBackUrl);
|
|
updateGoBackUrl();
|
|
</script>
|