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

Scroll active sidebar item into view #319

Merged
merged 1 commit into from
Sep 28, 2023
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
13 changes: 7 additions & 6 deletions docs/core_concepts/14_audit_logs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@ Audit Logs can be filtered by Date, Username, Action (Create, Update, Delete, Ex
src="/videos/audit_logs.mp4"
/>

<br/>
<br />

<div class="grid grid-cols-2 gap-6 mb-4">
<DocCard
title="Runs Menu"
description="The Runs menu is another feature that allows you to visualise all past and future runs."
href="/docs/core_concepts/audit_logs"
/>
<DocCard
title="Runs Menu"
description="The Runs menu is another feature that allows you to visualise all past and future runs."
href="/docs/core_concepts/monitor_past_and_future_runs"
/>
</div>

## Retention Policy

The retention policy for audit logs varies depending on your team's plan:

- Community plan: Audit logs are redacted.
- Team plan (cloud): Audit logs are retained for 7 days.
- Enterprise plan (cloud): Audit logs are retained for 60 days.
Expand Down
14 changes: 13 additions & 1 deletion src/theme/DocSidebarItem/Link/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect, useRef } from 'react';
import clsx from 'clsx';
import { ThemeClassNames } from '@docusaurus/theme-common';
import { isActiveSidebarItem } from '@docusaurus/theme-common/internal';
Expand All @@ -14,9 +14,20 @@ export default function DocSidebarItemLink({
index,
...props
}) {
const activeItemRef = useRef(null);
const { href, label, className, autoAddBaseUrl } = item;
const isActive = isActiveSidebarItem(item, activePath);
const isInternalLink = isInternalUrl(href);

useEffect(() => {
if (isActive && activeItemRef.current) {
activeItemRef.current.scrollIntoView({
behavior: 'smooth',
block: 'nearest'
});
}
}, [isActive]);

return (
<li
className={clsx(
Expand All @@ -28,6 +39,7 @@ export default function DocSidebarItemLink({
key={label}
>
<Link
ref={isActive ? activeItemRef : null}
className={clsx(
'menu__link',
!isInternalLink && styles.menuExternalLink,
Expand Down