Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(blog): rework blog ui and improve scrolling behavior #465

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion www/src/components/blog/pageContent.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const { frontmatter, headings, githubEditUrl } = Astro.props;
const title = frontmatter.title;
---

<article id="article" class="flex flex-col h-full w-full">
<article id="article" class="flex flex-col h-full w-full max-w-screen-lg">
<section class="mb-16 w-full">
<h1
id="overview"
Expand Down
4 changes: 2 additions & 2 deletions www/src/components/footer/footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const isLanding = path === "/";
<div
class="container px-6 mx-auto space-y-3 divide-y divide-gray-400 md:space-y-12 divide-opacity-50 pt-6"
>
<div class="flex flex-col sm:flex-row items-center justify-between w-full">
<div class="flex flex-col items-center justify-between w-full">
<div
class="pb-6 mb-6 sm:pb-0 sm:mb-0 border border-x-0 border-t-0 border-b-t3-purple-100 sm:border-0"
class="pb-6 mb-6 border border-x-0 border-t-0 border-b-t3-purple-100 sm:border-0"
>
<a
rel="noopener noreferrer"
Expand Down
10 changes: 5 additions & 5 deletions www/src/components/navigation/leftSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ const sidebar = SIDEBAR[langCode];

<nav
aria-labelledby="grid-left"
class={clsx({
"pt-3 pb-28": isLanding,
"pb-32 md:overflow-hidden": !isLanding,
class={clsx("flex flex-col gap-4 h-full pb-4 px-2 md:h-auto", {
"pt-3 md:pb-28": isLanding,
"md:pb-32 md:overflow-hidden": !isLanding,
})}
>
<div class="w-full mx-auto px-8 md:hidden">
<div class="w-full mx-auto px-4 md:px-8 md:hidden shrink-0">
<!-- Put Searchbar on Mobile Dropdown Navbar -->
<Search client:idle />
</div>
<ul
id="nav-groups"
class="p-8 h-full overflow-x-visible overflow-y-scroll t3-scrollbar sm:overflow-auto pb-32 dark:text-t3-purple-50 text-slate-900"
class="p-4 md:p-8 h-full overflow-x-visible overflow-y-scroll t3-scrollbar sm:overflow-auto pb-32 dark:text-t3-purple-50 text-slate-900"
>
{
Object.entries(sidebar).map(([header, children]) => (
Expand Down
2 changes: 1 addition & 1 deletion www/src/components/navigation/rightSidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const { headings, githubEditUrl } = Astro.props;

<nav
aria-labelledby="grid-right"
class="hidden md:block max-w-sm w-full overflow-auto mt-8 pr-2"
class="hidden md:block max-w-sm w-full overflow-auto pt-8 pr-2"
>
<div class="hidden md:block">
<TableOfContents client:media="(min-width: 768px)" headings={headings} />
Expand Down
24 changes: 14 additions & 10 deletions www/src/layouts/blog.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import type { MarkdownHeading } from "astro";
import clsx from "clsx";
import PageContent from "../components/blog/pageContent.astro";
import Footer from "../components/footer/footer.astro";
import HeadCommon from "../components/headCommon.astro";
Expand All @@ -20,6 +21,7 @@ const canonicalURL = new URL(Astro.url.pathname, Astro.site);
const currentPage = Astro.url.pathname;
const currentFile = `src/pages${currentPage.replace(/\/$/, "")}.md`;
const githubEditUrl = `${CONFIG.GITHUB_EDIT_URL}/${currentFile}`;
const asideWidth = "72";
---

<html
Expand All @@ -39,35 +41,37 @@ const githubEditUrl = `${CONFIG.GITHUB_EDIT_URL}/${currentFile}`;
<div class="bg-base sticky top-0 w-full z-50">
<Navbar />
</div>
<main
class="bg-base justify-items-start xl:justify-items-center grid grid-cols-1 sm:grid-cols-6 md:grid-cols-12 relative gap-4 transition-colors"
>
<main>
<aside
id="grid-left"
title="Site Navigation"
class="hidden sticky h-fit top-20 z-10 sm:w-screen md:w-full md:flex md:col-span-4 lg:col-span-3 xl:col-span-2 w-full transition-colors"
class={clsx(
"hidden fixed z-50 bg-base inset-0 top-20 t3-scrollbar overflow-hidden md:bottom-2 md:overflow-auto md:block md:w-72 ",
`w-${asideWidth}`,
)}
>
<LeftSidebar currentPage={currentPage} />
</aside>
<div
class="col-span-1 sm:col-span-6 md:col-span-8 lg:col-span-6 xl:col-span-8 w-full max-w-screen-md"
>
<div class="p-4 md:ml-72 lg:mr-72 flex flex-col items-center">
<PageContent
frontmatter={frontmatter}
headings={headings}
githubEditUrl={githubEditUrl}
>
<slot />
</PageContent>
<Footer path={currentFile} isBlog={true} />
</div>
<aside
id="grid-right"
id={"grid-right"}
title="Table of Contents"
class="hidden sticky h-fit top-20 md:block md:col-span-2 lg:col-span-3 xl:col-span-2 justify-self-start"
class={clsx(
"px-8 hidden lg:block fixed right-0 top-20 bottom-8",
`w-${asideWidth}`,
)}
>
<RightSidebar headings={headings} githubEditUrl={githubEditUrl} />
</aside>
</main>
<Footer path={currentFile} isBlog={true} />
</body>
</html>
3 changes: 1 addition & 2 deletions www/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,11 @@

.mobile-sidebar-toggle #grid-left {
display: block;
top: 2rem;
}

@media (min-width: 768px) {
.mobile-sidebar-toggle #grid-left {
display: none;
display: none;
}
}

Expand Down