Skip to content

Commit

Permalink
a few layout fixes for Safari printing viewport
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Sullivan committed Jun 9, 2023
1 parent 04e9c3c commit f455c1c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/starlight/components/Sidebar.astro
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface Props {
const { sidebar, locale } = Astro.props;
---

<div class="sidebar flex">
<div class="sidebar flex print:hidden">
<SidebarSublist sublist={sidebar} />
<div class="mobile-preferences flex md:hidden">
<ThemeSelect {locale} />
Expand Down
8 changes: 7 additions & 1 deletion packages/starlight/layout/PageFrame.astro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const t = useTranslations(locale);
<header class="header"><slot name="header" /></header>
{
hasSidebar && (
<nav class="sidebar" aria-label={t('sidebarNav.accessibleLabel')}>
<nav class="sidebar print:hidden" aria-label={t('sidebarNav.accessibleLabel')}>
<MobileMenuToggle {locale} />
<div id="starlight__sidebar" class="sidebar-pane">
<div class="sidebar-content">
Expand Down Expand Up @@ -89,4 +89,10 @@ const t = useTranslations(locale);
border-inline-end: 1px solid var(--sl-color-hairline-shade);
}
}

@media print {
.main-frame {
padding-inline-start: 0 !important;
}
}
</style>
9 changes: 8 additions & 1 deletion packages/starlight/layout/TwoColumnContent.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface Props {
<div class="lg:flex">
{
Astro.props.hasToC && (
<aside class="right-sidebar-container">
<aside class="right-sidebar-container print:hidden">
<div class="right-sidebar">
<slot name="right-sidebar" />
</div>
Expand Down Expand Up @@ -53,4 +53,11 @@ interface Props {
);
}
}

@media print {
.main-pane {
--sl-sidebar-width: 0px;
--sl-content-width: 100%;
}
}
</style>

0 comments on commit f455c1c

Please sign in to comment.