Skip to content

Commit

Permalink
fix scroll bug
Browse files Browse the repository at this point in the history
  • Loading branch information
steve8708 committed May 5, 2024
1 parent e9037a2 commit 3ad5f52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/docs/src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default component$(() => {
share feedback
</a>
</div>
<header class="text-white sticky top-0 z-10 border-y border-primary border-opacity-50 bg-purple-990">
<header class="text-white sticky top-0 z-60 border-y border-primary border-opacity-50 bg-purple-990">
<div
class={[
'p-6 max-md:p-4 flex justify-between items-center transition-all mx-auto container',
Expand Down
6 changes: 3 additions & 3 deletions packages/docs/src/routes/docs/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { component$, Slot } from '@builder.io/qwik';
import { useNavigate } from '@builder.io/qwik-city';
import { useLocation, useNavigate } from '@builder.io/qwik-city';
import { RightSidebar } from './right-sidebar';
import Sidebar from './sidebar';

export default component$(() => {
const nav = useNavigate();
const location = useLocation();

return (
<div class="flex items-start max-md:flex-col-reverse gap-8 max-md:mt-2">
Expand All @@ -14,7 +15,6 @@ export default component$(() => {
<div
onClick$={(e, el) => {
const closestHeading = (e.target as HTMLElement)?.closest('h1, h2, h3, h4, h5, h6');
console.log('closest heading', closestHeading, closestHeading?.id);
if (closestHeading?.id) {
const url = new URL(window.location.href);
url.hash = closestHeading.id;
Expand All @@ -26,7 +26,7 @@ export default component$(() => {
<Slot />
</div>
<div class="w-[240px] sticky top-20 shrink-0 ml-8 max-lg:hidden">
<RightSidebar class="mt-16 max-md:mt-4" />
<RightSidebar key={location.url.pathname} class="mt-16 max-md:mt-4" />
</div>
</div>
);
Expand Down

0 comments on commit 3ad5f52

Please sign in to comment.