From 9dbe72c150aa1cafe686dcf3f5d6c9f1486417a6 Mon Sep 17 00:00:00 2001 From: rishab Date: Sat, 9 Nov 2024 00:09:45 +0530 Subject: [PATCH 1/2] Move to top button --- src/components/MoveToTopButton/index.astro | 38 +++++++++++++++++ src/layouts/BaseLayout.astro | 9 ++--- styles/move-to-top.scss | 47 ++++++++++++++++++++++ 3 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 src/components/MoveToTopButton/index.astro create mode 100644 styles/move-to-top.scss diff --git a/src/components/MoveToTopButton/index.astro b/src/components/MoveToTopButton/index.astro new file mode 100644 index 0000000000..1dde79c1be --- /dev/null +++ b/src/components/MoveToTopButton/index.astro @@ -0,0 +1,38 @@ +--- +const { class: customClass = "" } = Astro.props; +--- + + + + diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index e711c57b2a..51ccf0d912 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -11,6 +11,8 @@ import "@styles/base.scss"; import type { CollectionEntry } from "astro:content"; import { getCollectionInLocaleWithFallbacks } from "@pages/_utils"; import { removeLocalePrefix } from "@i18n/utils"; +import MoveToTopButton from "@components/MoveToTopButton/index.astro"; +import "@styles/move-to-top.scss"; interface Props { title: string; @@ -21,7 +23,6 @@ interface Props { variant?: "root" | "item" | "search" | "homepage"; topic?: PageTopic; mainContentParentClass?: string; - /* Only needed for the homepage */ homepageConfig?: CollectionEntry<"homepage">; } @@ -62,10 +63,7 @@ const headerTopic = topic : { name: t(capitalize(fallbackTopic)) as string, url: `/${fallbackTopic}` }; --- - + +