mirror of
https://github.com/tabler/tabler.git
synced 2026-08-28 12:56:24 +04:00
- navbar-folded / navbar-folded-hover with flyout submenus and persisted pin toggle - sidebar refresh: light by default, 16rem wide, rounded inset pills, zero-jump fold - demo pages, Theme Settings section, docs and btn-action usage rule
146 lines
4.8 KiB
Plaintext
146 lines
4.8 KiB
Plaintext
---
|
|
// TODO: no-container (<div class="container-xl">-less body) — unused so far.
|
|
import BaseLayout from './BaseLayout.astro'
|
|
import Navbar from '@shared/components/navbar/Navbar.astro'
|
|
import Sidebar from '@shared/components/navbar/Sidebar.astro'
|
|
import PageHeader from '@shared/components/layout/PageHeader.astro'
|
|
import Footer from '@shared/components/layout/Footer.astro'
|
|
|
|
interface Props {
|
|
title?: string | undefined
|
|
/** Script/CSS library keys passed to BaseLayout */
|
|
pageLibs?: string[]
|
|
/** page-header — the title in the page header. Defaults to `title`; pass false for no page header */
|
|
pageHeader?: string | false | undefined
|
|
/** page-header-file — renders a layout/headers/{file} component instead of the title block */
|
|
pageHeaderFile?: string | undefined
|
|
/** page-header-pretitle */
|
|
pretitle?: string | undefined
|
|
/** page-header-description */
|
|
description?: string | undefined
|
|
/** page-menu from the front matter, e.g. "layout.vertical" — active menu entry */
|
|
pageMenu?: string | undefined
|
|
/** layout-sidebar */
|
|
sidebar?: boolean
|
|
/** layout-sidebar-dark */
|
|
sidebarDark?: boolean
|
|
/** layout-hide-topbar */
|
|
hideTopbar?: boolean
|
|
/** page-container-centered — adds my-auto to the .container-xl */
|
|
containerCentered?: boolean
|
|
/** layout-wrapper-full — page-wrapper-full + no .container-xl around the body */
|
|
wrapperFull?: boolean
|
|
/** page-container-class — extra classes appended to the .container-xl */
|
|
containerClass?: string
|
|
/** body-class front matter (e.g. "layout-boxed"/"layout-fluid") → passed to BaseLayout */
|
|
bodyClass?: string
|
|
/** layout-rtl → passed to BaseLayout (dir="rtl" + RTL stylesheets) */
|
|
rtl?: boolean
|
|
/** layout-sidebar-end */
|
|
sidebarEnd?: boolean
|
|
/** layout-sidebar-folded — icon-only sidebar rail with flyout submenus */
|
|
sidebarFolded?: boolean
|
|
/** layout-sidebar-folded-hover — folded rail that unfolds on hover/focus */
|
|
sidebarFoldedHover?: boolean
|
|
/** renders the runtime fold toggle button in the sidebar */
|
|
sidebarFoldToggle?: boolean
|
|
/** layout-navbar-transparent (sidebar variant) */
|
|
navbarTransparent?: boolean
|
|
/** layout-navbar-condensed */
|
|
navbarCondensed?: boolean
|
|
/** layout-navbar-dark */
|
|
navbarDark?: boolean
|
|
/** layout-navbar-overlap */
|
|
navbarOverlap?: boolean
|
|
/** layout-navbar-sticky */
|
|
navbarSticky?: boolean
|
|
/** layout-navbar-hide-brand */
|
|
navbarHideBrand?: boolean
|
|
/** layout-navbar-class */
|
|
navbarClass?: string
|
|
}
|
|
|
|
const {
|
|
title,
|
|
pageLibs,
|
|
pageHeader,
|
|
pageHeaderFile,
|
|
pretitle,
|
|
description,
|
|
pageMenu,
|
|
sidebar,
|
|
sidebarDark,
|
|
hideTopbar,
|
|
containerCentered,
|
|
wrapperFull,
|
|
containerClass,
|
|
bodyClass,
|
|
rtl,
|
|
sidebarEnd,
|
|
sidebarFolded,
|
|
sidebarFoldedHover,
|
|
sidebarFoldToggle,
|
|
navbarTransparent,
|
|
navbarCondensed,
|
|
navbarDark,
|
|
navbarOverlap,
|
|
navbarSticky,
|
|
navbarHideBrand,
|
|
navbarClass,
|
|
} = Astro.props
|
|
|
|
// Most pages repeat the page title verbatim, so `pageHeader` falls back to `title`.
|
|
// Pages that deliberately have no header (blank, playgrounds) pass pageHeader={false}.
|
|
const headerTitle = pageHeader === false ? undefined : (pageHeader ?? title)
|
|
---
|
|
|
|
<BaseLayout title={title} pageLibs={pageLibs} bodyClass={bodyClass} rtl={rtl} description={description}>
|
|
<div class="page">
|
|
{
|
|
sidebar && (
|
|
<Fragment>
|
|
<Fragment set:html={'<!-- BEGIN SIDEBAR -->'} />
|
|
<Sidebar dark={sidebarDark} end={sidebarEnd} transparent={navbarTransparent} folded={sidebarFolded} foldedHover={sidebarFoldedHover} foldToggle={sidebarFoldToggle} breakpoint="lg" pageMenu={pageMenu} />
|
|
<Fragment set:html={'<!-- END SIDEBAR -->'} />
|
|
</Fragment>
|
|
)
|
|
}
|
|
|
|
{
|
|
!hideTopbar && (
|
|
<Fragment>
|
|
<Fragment set:html={'<!-- BEGIN NAVBAR -->'} />
|
|
<Navbar hideSearch pageMenu={pageMenu} condensed={navbarCondensed} dark={navbarDark} overlap={navbarOverlap} sticky={navbarSticky} hideBrand={navbarHideBrand} class={navbarClass} />
|
|
<Fragment set:html={'<!-- END NAVBAR -->'} />
|
|
</Fragment>
|
|
)
|
|
}
|
|
|
|
<div class:list={['page-wrapper', wrapperFull && 'page-wrapper-full']}>
|
|
<!-- BEGIN PAGE HEADER -->
|
|
<PageHeader title={headerTitle} pretitle={pretitle} description={description} file={pageHeaderFile} textWhite={navbarOverlap && navbarDark}>
|
|
<slot name="page-header-actions" slot="actions" />
|
|
</PageHeader>
|
|
<!-- END PAGE HEADER -->
|
|
|
|
<!-- BEGIN PAGE BODY -->
|
|
<main id="content" class="page-body">
|
|
{
|
|
wrapperFull ? (
|
|
<slot />
|
|
) : (
|
|
<div class={`container-xl${containerCentered ? ' my-auto' : ''}${containerClass ? ` ${containerClass}` : ''}`}>
|
|
<slot />
|
|
</div>
|
|
)
|
|
}
|
|
</main>
|
|
<!-- END PAGE BODY -->
|
|
|
|
<!-- BEGIN FOOTER -->
|
|
<Footer />
|
|
<!-- END FOOTER -->
|
|
</div>
|
|
</div>
|
|
</BaseLayout>
|