'use client'
import Sidebar from '../Sidebar/Sidebar'
import TOC from '../TOC/TOC'
import { useConfig } from 'nextra-theme-docs'
import { usePathname } from 'next/navigation'
import Link from 'next/link'
import { PencilSimple } from '@phosphor-icons/react/dist/ssr'
function Breadcrumb() {
const config = useConfig()
const { activePath } = config.normalizePagesResult
if (!activePath || activePath.length <= 1) return null
return (
)
}
function Pagination() {
const config = useConfig()
const { flatDocsDirectories, activeIndex } = config.normalizePagesResult
const prev = activeIndex > 0 ? flatDocsDirectories[activeIndex - 1] : null
const next = activeIndex < flatDocsDirectories.length - 1 ? flatDocsDirectories[activeIndex + 1] : null
if (!prev && !next) return null
return (
{prev ? (
Previous
{typeof prev.title === 'string' ? prev.title : prev.name}
) :
}
{next ? (
Next
{typeof next.title === 'string' ? next.title : next.name}
) :
}
)
}
function EditOnGitHub() {
const pathname = usePathname()
let filePath = pathname === '/' ? '/index' : pathname
const gitHubBase = 'https://github.com/learnhouse/docs/edit/main/content'
const href = `${gitHubBase}${filePath}.mdx`
return (
Edit on GitHub
)
}
function LastEdited({ timestamp }) {
if (!timestamp) return null
const date = new Date(timestamp).toLocaleDateString('en-US', {
month: 'short',
day: 'numeric',
year: 'numeric',
})
return (
Last edited on {date}
)
}
function CloudAd() {
return (
{/* Dot pattern background */}
Cloud
Try LearnHouse Cloud
Managed hosting with automatic updates, backups, and scaling.
)
}
export default function Wrapper({ children, toc, metadata }) {
const pathname = usePathname()
const isHome = pathname === '/'
return (
{!isHome && }
{children}
{!isHome && (
)}
{toc && toc.length > 0 && (
)}
)
}