diff --git a/src/components/StickyNav.astro b/src/components/StickyNav.astro new file mode 100644 index 0000000..73c2d0c --- /dev/null +++ b/src/components/StickyNav.astro @@ -0,0 +1,101 @@ +--- +import { getRelativeLocaleUrl } from "astro:i18n"; +import { useTranslations } from "../i18n/utils"; + +interface Props { + id: string; + total: number; + prev: { slug: string; title: string } | null; + next: { slug: string; title: string } | null; +} + +const { id, total, prev, next } = Astro.props; +const lang = (Astro.currentLocale as "es" | "en") || "es"; +const t = useTranslations(lang); +const tipPath = lang === "es" ? "consejo" : "tip"; +--- + +
+
+
+ + + + +
+ {prev ? ( + + + + ) : ( +
+ +
+ )} + +
+ 100cosasdev + #{id} / {total} +
+ + {next ? ( + + + + ) : ( +
+ +
+ )} +
+ + +
+ +
+
+
+
diff --git a/src/components/TipPage.astro b/src/components/TipPage.astro index 8f3c25a..e88c440 100644 --- a/src/components/TipPage.astro +++ b/src/components/TipPage.astro @@ -3,6 +3,7 @@ import { getEntry, getCollection, render, type CollectionEntry } from "astro:con import Layout from "../layouts/Layout.astro" import Navbar from "./Navbar.astro" import Footer from "./Footer.astro" +import StickyNav from "./StickyNav.astro" import { getRelativeLocaleUrl } from "astro:i18n" import { useTranslations } from "../i18n/utils" @@ -21,7 +22,7 @@ interface Props { next?: TipNavItem | null } -const { entry, total, alternateUrl, canonical, noindex = false, prev, next } = Astro.props +const { entry, total, alternateUrl, canonical, noindex = false, prev = null, next = null } = Astro.props const { Content } = await render(entry) const { id, title, category, author: authorId, categoryColor } = entry.data const description = (entry.body ?? "").slice(0, 160).replace(/[#>]/g, "").trim() @@ -358,17 +359,9 @@ const jsonLd = { + +