Add tablet layout

This commit is contained in:
saberzero1 2024-08-14 16:38:27 +02:00
parent 44cb4a43e1
commit 697127e8bb
5 changed files with 31 additions and 11 deletions

View File

@ -27,6 +27,8 @@ export const defaultContentPageLayout: PageLayout = {
Component.MobileOnly(Component.Spacer()), Component.MobileOnly(Component.Spacer()),
Component.Search(), Component.Search(),
Component.Darkmode(), Component.Darkmode(),
Component.TabletOnly(Component.TableOfContents()),
Component.TabletOnly(Component.Explorer()),
Component.DesktopOnly(Component.Explorer()), Component.DesktopOnly(Component.Explorer()),
], ],
right: [ right: [
@ -44,6 +46,7 @@ export const defaultListPageLayout: PageLayout = {
Component.MobileOnly(Component.Spacer()), Component.MobileOnly(Component.Spacer()),
Component.Search(), Component.Search(),
Component.Darkmode(), Component.Darkmode(),
Component.TabletOnly(Component.Explorer()),
Component.DesktopOnly(Component.Explorer()), Component.DesktopOnly(Component.Explorer()),
], ],
right: [], right: [],

View File

@ -0,0 +1,18 @@
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
export default ((component?: QuartzComponent) => {
if (component) {
const Component = component
const TabletOnly: QuartzComponent = (props: QuartzComponentProps) => {
return <Component displayClass="tablet-only" {...props} />
}
TabletOnly.displayName = component.displayName
TabletOnly.afterDOMLoaded = component?.afterDOMLoaded
TabletOnly.beforeDOMLoaded = component?.beforeDOMLoaded
TabletOnly.css = component?.css
return TabletOnly
} else {
return () => <></>
}
}) satisfies QuartzComponentConstructor

View File

@ -16,6 +16,7 @@ import Backlinks from "./Backlinks"
import Search from "./Search" import Search from "./Search"
import Footer from "./Footer" import Footer from "./Footer"
import DesktopOnly from "./DesktopOnly" import DesktopOnly from "./DesktopOnly"
import TabletOnly from "./TabletOnly"
import MobileOnly from "./MobileOnly" import MobileOnly from "./MobileOnly"
import RecentNotes from "./RecentNotes" import RecentNotes from "./RecentNotes"
import Breadcrumbs from "./Breadcrumbs" import Breadcrumbs from "./Breadcrumbs"
@ -39,6 +40,7 @@ export {
Search, Search,
Footer, Footer,
DesktopOnly, DesktopOnly,
TabletOnly,
MobileOnly, MobileOnly,
RecentNotes, RecentNotes,
NotFound, NotFound,

View File

@ -13,7 +13,7 @@ export type QuartzComponentProps = {
children: (QuartzComponent | JSX.Element)[] children: (QuartzComponent | JSX.Element)[]
tree: Node tree: Node
allFiles: QuartzPluginData[] allFiles: QuartzPluginData[]
displayClass?: "mobile-only" | "desktop-only" displayClass?: "mobile-only" | "tablet-only" | "desktop-only"
} & JSX.IntrinsicAttributes & { } & JSX.IntrinsicAttributes & {
[key: string]: any [key: string]: any
} }

View File

@ -109,13 +109,15 @@ a {
.desktop-only { .desktop-only {
display: initial; display: initial;
@media all and ($mobile) { @media all and ($desktop) {
display: none; display: none;
} }
&.toc { }
@media all and ($tablet) {
display: none; .tablet-only {
} display: none;
@media all and ($desktop) and (not ($mobile)) {
display: initial;
} }
} }
@ -124,11 +126,6 @@ a {
@media all and ($mobile) { @media all and ($mobile) {
display: initial; display: initial;
} }
&.toc {
@media all and ($tablet) {
display: initial;
}
}
} }
.page { .page {