Skip to content

Commit f455c1c

Browse files
author
Tony Sullivan
committed
a few layout fixes for Safari printing viewport
1 parent 04e9c3c commit f455c1c

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

packages/starlight/components/Sidebar.astro

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface Props {
1212
const { sidebar, locale } = Astro.props;
1313
---
1414

15-
<div class="sidebar flex">
15+
<div class="sidebar flex print:hidden">
1616
<SidebarSublist sublist={sidebar} />
1717
<div class="mobile-preferences flex md:hidden">
1818
<ThemeSelect {locale} />

packages/starlight/layout/PageFrame.astro

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const t = useTranslations(locale);
1515
<header class="header"><slot name="header" /></header>
1616
{
1717
hasSidebar && (
18-
<nav class="sidebar" aria-label={t('sidebarNav.accessibleLabel')}>
18+
<nav class="sidebar print:hidden" aria-label={t('sidebarNav.accessibleLabel')}>
1919
<MobileMenuToggle {locale} />
2020
<div id="starlight__sidebar" class="sidebar-pane">
2121
<div class="sidebar-content">
@@ -89,4 +89,10 @@ const t = useTranslations(locale);
8989
border-inline-end: 1px solid var(--sl-color-hairline-shade);
9090
}
9191
}
92+
93+
@media print {
94+
.main-frame {
95+
padding-inline-start: 0 !important;
96+
}
97+
}
9298
</style>

packages/starlight/layout/TwoColumnContent.astro

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface Props {
77
<div class="lg:flex">
88
{
99
Astro.props.hasToC && (
10-
<aside class="right-sidebar-container">
10+
<aside class="right-sidebar-container print:hidden">
1111
<div class="right-sidebar">
1212
<slot name="right-sidebar" />
1313
</div>
@@ -53,4 +53,11 @@ interface Props {
5353
);
5454
}
5555
}
56+
57+
@media print {
58+
.main-pane {
59+
--sl-sidebar-width: 0px;
60+
--sl-content-width: 100%;
61+
}
62+
}
5663
</style>

0 commit comments

Comments
 (0)