---
import BaseLayout from './BaseLayout.astro';
import { getCollection } from 'astro:content';
import Search from '../components/Search.astro';
const { title } = Astro.props;
// Define Navigation Structure
// Support Groups (items array), Single links (slug), or External Links (href)
const navigation = [
{ title: 'Introduction', slug: 'introduction' },
{ title: 'Quick Start', slug: 'quick_start' },
{ title: 'Core Concepts', slug: 'concepts' },
{ title: 'Performance', slug: 'performance' },
{ title: 'API Reference', href: 'https://docs.rs/varvedb/latest/varvedb/' },
];
const currentPath = Astro.url.pathname;
function isActive(slug) {
if (!slug) return false;
return currentPath.includes(slug);
}
---
<BaseLayout title={title}>
<div class="docs-container">
<aside class="docs-sidebar">
<div class="sidebar-sticky">
<Search />
<nav>
<ul>
{navigation.map(item => (
<>
{item.items ? (
// Group Header & Items
<li class="nav-group">
<span class="nav-group-title">{item.title}</span>
<ul class="nav-group-items">
{item.items.map(subItem => (
<li>
{subItem.href ? (
<a href={subItem.href} target="_blank" rel="noopener noreferrer">
{subItem.title} ↗
</a>
) : (
<a href={`/docs/${subItem.slug}`} class={isActive(subItem.slug) ? 'active' : ''}>
{subItem.title}
</a>
)}
</li>
))}
</ul>
</li>
) : (
// Top Level Link
<li>
{item.href ? (
<a href={item.href} target="_blank" rel="noopener noreferrer">
{item.title} ↗
</a>
) : (
<a href={`/docs/${item.slug}`} class={isActive(item.slug) ? 'active' : ''}>
{item.title}
</a>
)}
</li>
)}
</>
))}
</ul>
</nav>
</div>
</aside>
<article class="docs-content">
<h1>{title}</h1>
<slot />
</article>
</div>
</BaseLayout>
<style>
.docs-container {
display: flex;
gap: 4rem;
padding-top: 8rem; /* Increased top padding */
padding-bottom: 4rem;
padding-left: 2rem;
padding-right: 2rem;
min-height: 80vh;
max-width: 1600px;
margin: 0 auto;
}
/* Make sidebar sticky properly */
.docs-sidebar {
width: 280px;
flex-shrink: 0;
border-right: 1px solid #30363d;
padding-right: 2rem;
}
.sidebar-sticky {
position: sticky;
top: 8rem;
max-height: calc(100vh - 8rem);
overflow-y: auto;
}
.docs-sidebar nav > ul {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
/* Navigation Groups */
.nav-group {
margin-top: 1rem;
margin-bottom: 0.5rem;
}
.nav-group-title {
display: block;
font-size: 0.85rem;
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 700;
color: var(--text-muted);
margin-bottom: 0.5rem;
padding-left: 0.5rem; /* Match link padding visual alignment if needed */
}
.nav-group-items {
display: flex;
flex-direction: column;
gap: 0.25rem;
padding-left: 0.5rem; /* Indent sub-items slightly */
border-left: 1px solid rgba(255,255,255,0.05); /* Subtle tree line */
margin-left: 0.5rem;
}
.docs-sidebar a {
display: block;
padding: 0.4rem 0.8rem;
border-radius: 6px;
color: var(--text-muted);
transition: all 0.2s;
font-size: 0.95rem;
}
.docs-sidebar a:hover {
background: rgba(255, 255, 255, 0.05);
color: var(--text-main);
}
.docs-sidebar a.active {
background: rgba(56, 189, 248, 0.1);
color: var(--primary);
font-weight: 600;
}
/* Content Styles */
.docs-content {
flex: 1;
min-width: 0;
line-height: 1.7;
color: #c9d1d9;
}
.docs-content :global(h1) {
font-family: var(--font-heading);
font-size: 2.5rem;
margin-bottom: 1.5rem;
color: var(--text-main);
}
.docs-content :global(h2) {
font-family: var(--font-heading);
font-size: 1.8rem;
margin-top: 2.5rem;
margin-bottom: 1rem;
color: var(--text-main);
border-bottom: 1px solid #30363d;
padding-bottom: 0.5rem;
}
.docs-content :global(h3) {
font-size: 1.4rem;
margin-top: 2rem;
margin-bottom: 0.8rem;
color: var(--text-main);
}
.docs-content :global(p) {
margin-bottom: 1.2rem;
}
.docs-content :global(code) {
background: rgba(110, 118, 129, 0.4);
padding: 0.2em 0.4em;
border-radius: 4px;
font-family: var(--font-mono);
font-size: 0.9em;
}
.docs-content :global(pre) {
background: #0d1117 !important;
padding: 1.5rem;
border-radius: 8px;
border: 1px solid #30363d;
overflow-x: auto;
margin-bottom: 1.5rem;
}
.docs-content :global(pre code) {
background: none;
padding: 0;
font-size: 0.9rem;
}
.docs-content :global(ul), .docs-content :global(ol) {
margin-bottom: 1.2rem;
padding-left: 1.5rem;
}
.docs-content :global(li) {
margin-bottom: 0.5rem;
}
/* Style for Key Insights sections */
.docs-content :global(p strong:first-child) {
display: inline-block;
color: var(--primary);
text-transform: uppercase;
font-size: 0.85rem;
letter-spacing: 0.05em;
margin-bottom: 0.5rem;
}
/* Enhanced list styling for insights */
.docs-content :global(ul) {
position: relative;
}
.docs-content :global(li strong) {
color: var(--primary);
font-weight: 600;
}
.docs-content :global(a) {
color: var(--primary);
text-decoration: none;
}
.docs-content :global(a:hover) {
text-decoration: underline;
}
.docs-content :global(blockquote) {
border-left: 4px solid var(--primary);
padding-left: 1rem;
margin-left: 0;
margin-right: 0;
color: var(--text-muted);
background: rgba(255,255,255,0.02);
padding: 1rem;
border-radius: 0 4px 4px 0;
}
/* Modern Table Styling */
.docs-content :global(table) {
width: 100%;
border-collapse: separate;
border-spacing: 0;
margin: 2rem 0;
background: linear-gradient(135deg, rgba(15, 23, 42, 0.6) 0%, rgba(15, 23, 42, 0.4) 100%);
border-radius: 12px;
overflow: hidden;
box-shadow:
0 4px 6px -1px rgba(0, 0, 0, 0.3),
0 2px 4px -1px rgba(0, 0, 0, 0.2),
inset 0 1px 0 0 rgba(255, 255, 255, 0.05);
border: 1px solid rgba(56, 189, 248, 0.1);
}
.docs-content :global(thead) {
background: linear-gradient(135deg, rgba(56, 189, 248, 0.15) 0%, rgba(56, 189, 248, 0.08) 100%);
border-bottom: 2px solid rgba(56, 189, 248, 0.3);
}
.docs-content :global(th) {
padding: 1rem 1.25rem;
text-align: left;
font-weight: 600;
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
color: rgba(255, 255, 255, 0.95);
background: transparent;
position: relative;
}
.docs-content :global(th:not(:last-child))::after {
content: '';
position: absolute;
right: 0;
top: 25%;
height: 50%;
width: 1px;
background: rgba(56, 189, 248, 0.15);
}
.docs-content :global(tbody tr) {
border-bottom: 1px solid rgba(255, 255, 255, 0.04);
transition: all 0.2s ease;
position: relative;
}
.docs-content :global(tbody tr:hover) {
background: rgba(56, 189, 248, 0.06);
transform: scale(1.002);
box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.15);
}
.docs-content :global(tbody tr:last-child) {
border-bottom: none;
}
.docs-content :global(td) {
padding: 1rem 1.25rem;
color: rgba(201, 209, 217, 0.95);
font-size: 0.95rem;
vertical-align: middle;
}
.docs-content :global(td:first-child) {
font-weight: 500;
color: rgba(255, 255, 255, 0.9);
}
/* Highlight bold values in tables */
.docs-content :global(td strong) {
color: var(--primary);
font-weight: 700;
text-shadow: 0 0 20px rgba(56, 189, 248, 0.3);
font-size: 1.05em;
}
/* Monospace numbers for better alignment */
.docs-content :global(td:not(:first-child)) {
font-variant-numeric: tabular-nums;
font-family: var(--font-mono);
font-size: 0.9rem;
}
/* Zebra striping subtle effect */
.docs-content :global(tbody tr:nth-child(even)) {
background: rgba(255, 255, 255, 0.015);
}
/* Performance metrics color coding */
.docs-content :global(td:has(strong)) {
position: relative;
}
/* Responsive table wrapper */
.docs-content :global(table) {
display: table;
}
@media (max-width: 1024px) {
.docs-content :global(table) {
font-size: 0.875rem;
}
.docs-content :global(th),
.docs-content :global(td) {
padding: 0.75rem 1rem;
}
}
@media (max-width: 768px) {
.docs-container {
flex-direction: column;
}
.docs-sidebar {
width: 100%;
border-right: none;
border-bottom: 1px solid #30363d;
padding-bottom: 1.5rem;
}
.nav-group-items {
border-left: none;
padding-left: 0;
margin-left: 0;
}
/* Make tables horizontally scrollable on mobile */
.docs-content :global(table) {
display: block;
overflow-x: auto;
white-space: nowrap;
-webkit-overflow-scrolling: touch;
margin: 1.5rem -1rem; /* Extend to edges */
width: calc(100% + 2rem);
border-radius: 8px;
}
.docs-content :global(th),
.docs-content :global(td) {
padding: 0.625rem 0.875rem;
font-size: 0.8rem;
}
.docs-content :global(th) {
font-size: 0.75rem;
}
}
</style>