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

Docs: use third level in sidebar #2917

Merged
merged 8 commits into from
Dec 17, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
no bolding, no headers, hide pages with sidebar_link=false and no chi…
…ldren
  • Loading branch information
archiewood committed Dec 17, 2024
commit 0903361f88d7e926bef018428e8977acd08f2176
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@

function deleteEmptyNodes(node) {
Object.keys(node.children).forEach(function (key) {
deleteEmptyNodes(node.children[key]);
if (!node.children[key].label && !node.children[key].href) {
const child = node.children[key];
deleteEmptyNodes(child);

if (
(!child.label && !child.href) ||
(child.children.length === 0 && (child.frontMatter?.sidebar_link === false))
) {
delete node.children[key];
}
});
Expand Down Expand Up @@ -56,6 +61,13 @@

export let mobileSidebarOpen = false;

// No bolding on headers
// No accordion behavior
// border physically slides down, colour should transition at the same time svelte cross fade: send/ receive. div at the same size that only appears svelte if active, transition: send recieve example https://github.com/evidence-dev/evidence/blob/68253cb7f13b2e3c65e452dddc810a100d8c0bd1/sites/docs/components/DocTab.svelte#L3
// consider transition
// add an option for sidebar depth in default layout
// we should be able to list out templated pages in the sidebar

// prevent scrolling of the underlying when the mobile sidebar is open
afterUpdate(() => {
// afterupdate ensures that the mobileScrollable div is mounted before we lock everything else
Expand Down Expand Up @@ -203,7 +215,7 @@
thirdLevelFile.href.toUpperCase() + '/'}
<a
href={addBasePath(thirdLevelFile.href)}
class="group inline-block py-1 first:pt-0.5 first:mt-1 last:pb-0.5 last:mb-1 pl-3 capitalize transition-all duration-100 border-l ml-1 {active
class="group inline-block py-1 first:pt-0.5 first:mt-1 last:pb-0.5 last:mb-1 pl-3 capitalize transition-all duration-100 border-l {active
? 'text-primary border-primary'
: 'text-base-content-muted hover:text-base-content hover:border-base-content'}"
>
Expand Down Expand Up @@ -308,7 +320,7 @@
</a>
{:else}
<span
class="group inline-block py-1 capitalize transition-all duration-100 text-base-content-muted font-medium"
class="group inline-block py-1 capitalize transition-all duration-100 text-base-content-muted "
>
{secondLevelFile.frontMatter?.title ?? secondLevelFile.label}
{#if secondLevelFile.frontMatter?.sidebar_badge}
Expand All @@ -327,7 +339,7 @@
thirdLevelFile.href.toUpperCase() + '/'}
<a
href={addBasePath(thirdLevelFile.href)}
class="group inline-block py-1 first:pt-0.5 first:mt-1 last:pb-0.5 last:mb-1 pl-3 capitalize transition-all duration-100 border-l ml-1 {active
class="group inline-block py-1 first:pt-0.5 first:mt-1 last:pb-0.5 last:mb-1 pl-3 capitalize transition-all duration-100 border-l {active
? 'text-primary border-primary'
: 'text-base-content-muted hover:text-base-content hover:border-base-content'}"
>
Expand Down
Loading