Skip to content

Commit 38c41f7

Browse files
authored
Followup print styles (#643)
1 parent 1ffb074 commit 38c41f7

6 files changed

Lines changed: 15 additions & 13 deletions

File tree

web/src/components/Breadcrumbs.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const { items } = Astro.props;
1616
{
1717
items.map((item) => (
1818
<li>
19-
<a href={item.href}>{item.label}</a>
19+
<a href={item.href} data-no-print-url>
20+
{item.label}
21+
</a>
2022
</li>
2123
))
2224
}

web/src/components/Footer.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const linkGroups: LinkGroup[] = [
4848
];
4949
---
5050

51-
<footer>
51+
<footer data-no-print>
5252
<div class="footer-illustration">
5353
<img
5454
src="/site/footer/snail.png"

web/src/components/GuideFooter.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const displayDate = new Date(lastModified).toLocaleDateString("en-US", {
2727
<footer>
2828
{
2929
editUrl && (
30-
<a href={editUrl} class="edit-link">
30+
<a href={editUrl} class="edit-link" data-no-print>
3131
<RiPencilLine size={20} />
3232
Edit this page
3333
</a>

web/src/components/Header.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const navLinks = [
1111
];
1212
---
1313

14-
<header>
14+
<header data-no-print>
1515
<a href="/" aria-label="Home" id="logo"><Logo /></a>
1616
<nav aria-label="Site">
1717
<ul>

web/src/layouts/ProseLayout.astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const headerDescription =
5959
breadcrumbs={breadcrumbs}
6060
/>
6161
<slot name="after-header" />
62-
<section class="toc">
62+
<section class="toc" data-no-print>
6363
<slot name="toc" />
6464
</section>
6565
<section itemprop="articleBody" class="prose">

web/src/styles/print.css

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
/* These styles are only used when printing the page. */
21
/* biome-ignore-all lint/complexity/noImportantStyles: print styles should always override site styles */
32

43
@media print {
54
html,
65
body {
7-
background-color: none;
8-
}
9-
10-
body > *:not(main) {
11-
display: none !important;
6+
--background-color: white !important;
7+
background-color: transparent !important;
128
}
139

1410
body::before,
@@ -17,7 +13,7 @@
1713
}
1814

1915
.rough-annotation {
20-
display: none; /* Would display in odd location due to loading delay. */
16+
display: none;
2117
}
2218

2319
details::details-content {
@@ -26,11 +22,15 @@
2622
opacity: 1 !important;
2723
}
2824

29-
a[href]:not([href^="#"])::after {
25+
a[href]:not([href^="#"]):not([data-no-print-url])::after {
3026
content: " (" attr(href) ")";
3127
}
3228

3329
abbr[title]::after {
3430
content: " (" attr(title) ")";
3531
}
32+
33+
[data-no-print] {
34+
display: none !important;
35+
}
3636
}

0 commit comments

Comments
 (0)